Selecting the value in child form and sending it to parent form

Contributed by
Rating: 3 stars3 stars3 stars3 stars3 stars / 14
July 21, 2002
Rate this Article:
MEH MEH++


SEARCH ASP FREE
TOOLS YOU CAN USE

advertisement
The Code below has : - main.aspx page which has a textbox and a link to select the catergoryname - main2.aspx page has the actual selection criteria of the Categoryname to be selected from dropdownlist - On selection of the data from the dropdown the data should be send back to the main.aspx [bold]Step 1:main.aspx[/bold]

 
<FORM id=Form1 method=get runat="server"><asp:TextBox id=txtSelect 
style
="Z-INDEX: 101; LEFT: 186px; POSITION: absolute; TOP: 19px" 
runat="server"></asp:TextBox><
href
="javascript:my_window=window.open         ('main2.aspx?formname=Form1.txtSelect','my_window','width=300,height=300');
my_window.focus()"
>Select 
CategoryName 
</A></FORM>

Step 2: main2.aspx

 
<FORM id=Form1 method=post runat="server"><asp:DropDownList id=DropDownList1 
style
="Z-INDEX: 101; LEFT: 180px; POSITION: absolute; TOP: 66px" runat="server" 
AutoPostBack="True"></asp:DropDownList><asp:Label id=Label1 
style
="Z-INDEX: 102; LEFT: 16px; POSITION: absolute; TOP: 66px" 
runat="server">Select Category Name</asp:Label> <asp:Literal id=Literal1 
runat
="server"></asp:Literal></FORM>


Step 3: main2.aspx.vb

 
Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As System.Object
ByVal e As System.EventArgsHandles DropDownList1.SelectedIndexChanged Try Dim 
strjscript 
As String "
<SCRIPT language="" javascript?

"

strjscript strjscript "window.opener." HttpContext.Current.Request.QueryString("formname") & ".value = '" DropDownList1.SelectedItem.Text "';window.close();"

strjscript strjscript "</SCRIPT>
 " 
Literal1.Text strjscript Catch ex As Exception Response.Write(ex.Message
End Try End Sub 

blog comments powered by Disqus
ASP.NET CODE ARTICLES

- How to Use the ListBox Control in ASP.NET 2.0
- How to Load XML Documents in ASP.NET 2.0
- DataGrid Code
- ASP.NET Guestbook
- User Controls and Client Side Scripting
- ASP.NET Programming with Microsoft's AS...
- ASP.NET Basics (part 3): Hard Choices
- ASP.NET Basics (part 2): Not My Type
- ASP.NET Basics (part 1): Nothing But .Net
- Directory Tree Browser
- How to get the confirmation of Yes/No from a...
- Complete example using custom errors and wri...
- Paging Certain # records per page .NET style
- General Methods of formatting and Subtractin...
- .NET LinkButton web control

ASP Web Hosting ASP.Net Web Hosting Windows Web Hosting
 
 
 

ASP Free Forums 
 RSS  Tutorials RSS
 RSS  Forums RSS
 RSS  All Feeds
Site Map 
Request Media Kit
Write For Us Get Paid 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Privacy Policy 
Support 


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 2 - Follow our Sitemap
Most Popular Topics
All ASP.Net Tutorials