This is a discussion on How to select a value from a child form and send it to parent form? within the ASP and ASP.NET Programming forums, part of the Web Development category; How to select a value from a child form and send it to parent form?...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| page1 <asp:TextBox id="txtSelect" style="Z-INDEX: 101; LEFT: 186px; POSITION: absolute; TOP: 19px" runat="server"></asp:TextBox> <a href="javascript:my_window=window.open('page2.aspx ?formname=Form1.txtSelect','my_window','width=300, height=300');my_window.focus()"> Select CategoryName</a> page2 <asp ropDownList id="DropDownList1" style="Z-INDEX: 101; LEFT: 180px; POSITION: absolute; TOP: 66px"runat="server" AutoPostBack="True"> <asp:Label id="Label1" style="Z-INDEX: 102; LEFT: 16px; POSITION: absolute; TOP: 66px" runat="server">Select Category Name <asp:Literal id="Literal1" runat="server"> private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here if (!Page.IsPostBack ) { //Fill DataSet DropDownList1.DataSource = ds.Tables[0]; DropDownList1.DataTextField = "CategoryName"; DropDownList1.DataValueField = "CategoryId"; DropDownList1.DataBind(); } } private void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e) { try { string strjscript = @"<script language=""javascript"">"; strjscript = strjscript + "window.opener." + HttpContext.Current.Request.QueryString["formname"].ToString () + ".value = '" + DropDownList1.SelectedItem.Text + "';window.close();"; strjscript = strjscript + "</script>"; Literal1.Text = strjscript; } catch(Exception ex) { Response.Write (ex.Message ); } } |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Date/time stamp a form field as the form is submitted | itbarota | HTML, CSS and Javascript Coding Techniques | 1 | 02-06-2008 10:16 PM |
| Date/Time stamp a form field as the form is submitted | itbarota | HTML, CSS and Javascript Coding Techniques | 2 | 01-17-2008 08:47 PM |
| How can I clear the form field values after the user has submitted the form for clien | itbarota | HTML, CSS and Javascript Coding Techniques | 1 | 11-01-2007 11:39 PM |
| How can I pass a hidden value to a form and submit that form when a text link is clic | itbarota | HTML, CSS and Javascript Coding Techniques | 1 | 10-17-2007 08:07 AM |
| How to send variables from a PHP script to another URL, using POST without using form | oxygen | PHP Programming | 1 | 07-26-2007 03:25 AM |