Can you help me about set value for textfiled in Child/Parent page???

  1. #1

    Can you help me about set value for textfiled in Child/Parent page???

    Click image for larger version. 

Name:	img.PNG 
Views:	171 
Size:	59.7 KB 
ID:	4290Hi Pros,


    I have 3 page with method call such as:

    Parent->Parent->Child:

    This is page with parent 2:

    .aspx page:

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="AddCourseInYear.aspx.cs"
        Inherits="Tranning_Planning_AddCourseInYear" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext2" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    
        <script type="text/javascript">
            var onKeyUp = function(field) {
                var v = this.processValue(this.getRawValue()),
                    field;
                if (v.length < 1) {
                    if (this.startDateField) {
                        field = Ext.getCmp(this.startDateField);
                        field.setMaxValue();
                        this.dateRangeMax = null;
                    } else if (this.endDateField) {
                        field = Ext.getCmp(this.endDateField);
                        field.setMinValue();
                        this.dateRangeMin = null;
                    }
                    field.validate();
                }
            };
            var CWindow = function(winid, url, tl) {
                var win = new parent.Ext.Window({
                    id: winid,
                    width: 700,
                    height: 400,
                    title: tl,
                    floating: true,
                    hidden: false,
                    closable: true,
                    modal: true,
                    layout: 'fit',
                    draggable: true,
                    constrain: true,
                    closeAction: "close",
                    icon: "Application",
                    html: "<iframe src='" + url + "' frameborder=\"0\" width=\"100%\" height=\"100%\" scrolling=\"yes\"></iframe>"
                });
            };
            
        </script>
    
    </head>
    <body>
        <form id="form1" runat="server">
        <ext2:ResourceManager runat="server" />
        <ext2:FormPanel ID="FormPanel1" runat="server" Border="false" BodyStyle="background-color:transparent"
            Layout="Form" Padding="5" MonitorValid="true">
            <Items>
                <ext2:CompositeField runat="server" FieldLabel="Số ngày" AnchorHorizontal="100%">
                    <Items>
                        <ext2:NumberField ID="txtSoNgay" runat="server" FieldLabel="Số ngày" Width="50" AllowBlank="false" />
                        <ext2:DisplayField ID="DisplayField1" runat="server" Text="Ngày bắt đầu:" />
                        <ext2:DateField ID="dfStartDate" runat="server" Vtype="daterange" FieldLabel="Ngày bắt đầu"
                            AnchorHorizontal="30%" AllowBlank="false" Format="dd/MM/yyyy">
                            <CustomConfig>
                                <ext2:ConfigItem Name="endDateField" Value="#{dfEndDate}" Mode="Value" />
                            </CustomConfig>
                            <Listeners>
                                <KeyUp Fn="onKeyUp" />
                            </Listeners>
                        </ext2:DateField>
                        <ext2:DisplayField ID="DisplayField2" runat="server" Text="Ngày kết thúc:" />
                        <ext2:DateField ID="dfEndDate" runat="server" Vtype="daterange" FieldLabel="Ngày kết thúc"
                            AnchorHorizontal="30%" AllowBlank="false" Format="dd/MM/yyyy">
                            <CustomConfig>
                                <ext2:ConfigItem Name="startDateField" Value="#{dfStartDate}" Mode="Value" />
                            </CustomConfig>
                            <Listeners>
                                <KeyUp Fn="onKeyUp" />
                            </Listeners>
                        </ext2:DateField>
                    </Items>
                </ext2:CompositeField>
                <ext2:TextArea ID="txtNoiDung" runat="server" FieldLabel="Nội dung" AnchorHorizontal="100%"
                    AllowBlank="false" />
                <ext2:ComboBox ID="CbbPlace" runat="server" AllowBlank="false" EmptyText="Chọn địa điểm ..."
                    FieldLabel="Địa điểm tổ chức">
                </ext2:ComboBox>
                <ext2:TextField ID="txtDonViToChuc" runat="server" FieldLabel="Đơn vị tổ chức" AnchorHorizontal="100%"
                    AllowBlank="true" />
                <ext2:CompositeField ID="CompositeField1" runat="server" FieldLabel="Giảng viên"
                    AnchorHorizontal="100%">
                    <Items>
                        <ext2:TextField ID="txtGiangVien" runat="server" FieldLabel="Giảng viên" Width="430" />
                        <ext2:Button ID="Button2" Icon="Disk" Text="Chọn" runat="server">
                            <DirectEvents>
                                <Click OnEvent="SelectTeacher" />
                            </DirectEvents>
                            <Listeners>
                                <Click Handler="return #{FormPanel1}.getForm().isValid();" />
                            </Listeners>
                        </ext2:Button>
                    </Items>
                </ext2:CompositeField>
            </Items>
            <Buttons>
                <ext2:Button ID="btnSave" Icon="Disk" Text="Lưu" runat="server">
                    <DirectEvents>
                        <Click OnEvent="AddNew" />
                    </DirectEvents>
                    <Listeners>
                        <Click Handler="return #{FormPanel1}.getForm().isValid();" />
                    </Listeners>
                </ext2:Button>
                <ext2:Button ID="Button1" Icon="Cancel" Text="Đóng" runat="server">
                    <Listeners>
                        <Click Handler="#{FormPanel1}.getForm().reset();parent.Ext.WindowMgr.getActive().hide();" />
                    </Listeners>
                </ext2:Button>
            </Buttons>
            <Listeners>
                <Hide Handler="if (!#{FormPanel1}.isValid()) {
                                #{FormPanel1}.reset();
                           }" />
            </Listeners>
        </ext2:FormPanel>
        </form>
    </body>
    </html>
    code-behind code:
    I call:
    protected void SelectTeacher(object sender, DirectEventArgs e)
        {
            X.Js.Call("CWindow", "winTeacher", "Tranning/Planning/SelectTeacher.aspx?makhoa=" + GetQueryValue("url") +
                                    "&startdate=" + dfStartDate.SelectedDate.ToString("MM/dd/yyyy") +
                                    "&enddate= " + dfEndDate.SelectedDate.ToString("MM/dd/yyyy"), 
                                    "Danh sách cán bộ có thể giảng");
    
        }
    And Child is any page:

    Now, I want from child page, which set value for textbox(txtGiangVien) of parent 2.
    Child Page:
    <Buttons>
                <ext2:Button ID="Button1" runat="server" Text="Chọn" Icon="Accept">
                    <DirectEvents>
                        <Click OnEvent="Select">
                            <ExtraParams>
                                <ext2:Parameter Name="Values" Value="Ext.encode(#{GridPanel2}.getRowsValues(false, false, true))"
                                    Mode="Raw" />
                            </ExtraParams>
                            <EventMask ShowMask="true" />
                        </Click>
                    </DirectEvents>                
                </ext2:Button>
                <ext2:Button ID="Button2" runat="server" Text="To the B" Icon="ArrowRight">
                    <Listeners>
                        <Click Handler="parent.#{txtGiangVien}.SetValue('a');" />
                    </Listeners>
                </ext2:Button>
    Can Everybody help me? Thx u so much
    Last edited by hazardvn; May 28, 2012 at 4:05 AM. Reason: Add image
  2. #2
    I fixed this problem,

    Thx so much,

Similar Threads

  1. Replies: 2
    Last Post: Nov 15, 2012, 12:52 AM
  2. [CLOSED] Open parent window from child page using DirectEvent?
    By tjshin in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jun 15, 2012, 2:25 PM
  3. Replies: 1
    Last Post: Feb 03, 2012, 2:36 PM
  4. Replies: 1
    Last Post: Feb 01, 2012, 2:35 PM
  5. [CLOSED] Child page to parent page call
    By majestic in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Oct 05, 2010, 5:41 PM

Posting Permissions