IT Community - Software Programming, Web Development and Technical Support

How to select a value from a child form and send it to parent form?

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?...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > ASP and ASP.NET Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 09-19-2007, 10:17 PM
GDevakii GDevakii is offline
D-Web Sr.Programmer
 
Join Date: Aug 2007
Posts: 138
GDevakii is on a distinguished road
Question How to select a value from a child form and send it to parent form?

How to select a value from a child form and send it to parent form?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 09-20-2007, 10:14 PM
kingmaker kingmaker is offline
D-Web Genius
 
Join Date: Jun 2007
Posts: 882
kingmaker is on a distinguished road
Send a message via Yahoo to kingmaker
Default Re: How to select a value from a child form and send it to parent form?

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

<aspropDownList 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 );
}
}
__________________
The KINGMAKER
Makes Every Thing Possible

Stuffs (My Blog)
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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


All times are GMT -7. The time now is 02:56 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0