salmani Posted September 22, 2003 Posted September 22, 2003 I have bind a list to logins to the dropdownlist control. And Thanks God it worked fine. Suppose database structure is like ******************************** ID NAME 1 Salman 2 Richards 3 Marry ********************************** But my problem is i want to pass the ID to the next page. When the users click any login for e.g salman, the page should submit and id(for e.g 1) should be passed to next page. I don't have any idea... How it can be done??? Will any one help??? Regards Salman --------------------------------------------------------------------------------- <%@ Import Namespace="System.Data.SqlClient" %> <%@ Page Language="vb"%> <HTML> <HEAD> <title>Dropdown Binding</title> <script runat="server"> Sub Page_load 'if not IsPostBack then Dim conPubs as SqlConnection Dim cmdSelect as SqlCommand Dim dtrAuthors as SqlDataReader conPubs = New SqlConnection("Server=WIN2K3\OMER; UID=sa; PWD=sa; database=personal") conPubs.Open() cmdSelect = New SqlCommand("Select name from login", conPubs) dtrAuthors=cmdSelect.ExecuteReader() dropAuthors.DataSource=dtrAuthors dropAuthors.DataTextField="name" dropAuthors.DataBind() dtrAuthors.Close() conPubs.Close() 'End if End Sub Sub Press(Sender as object, E as EventArgs) Name.text=dropAuthors.selectedItem.Text end sub </script> </HEAD> <body MS_POSITIONING="GridLayout"> <TABLE height="206" cellSpacing="0" cellPadding="0" width="101" border="0" ms_2d_layout="TRUE"> <TR vAlign="top"> <TD width="101" height="206"> <form runat="server"> <TABLE height="84" cellSpacing="0" cellPadding="0" width="194" border="0" ms_2d_layout="TRUE"> <TR vAlign="top"> <TD colSpan="3" height="2"></TD> <TD colSpan="2" rowSpan="2"> <asp:Button Text="Pick Authors" onclick="Press" Runat="server" id="Button1"></asp:Button></TD> </TR> <TD colSpan="3"> <asp:DropDownList ID="dropAuthors" Runat="server"></asp:DropDownList></TD> </TR> <TR vAlign="top"> <TD colSpan="2" height="20"></TD> <TD colSpan="2"> <asp:Label id="Label1" runat="server">You have selected</asp:Label></TD> <TD> <asp:Label ID="Name" runat="server"></asp:Label></TD> </TR> </TABLE> </form> </body> </HTML> ----------------------------------------------------------------------------------- Quote
papa_k Posted September 22, 2003 Posted September 22, 2003 not sure if this will help but it concerns the same sort of thing. http://www.xtremedotnettalk.com/t76937.html you should make sure that when you open the page that moving to you use a server.transfer("thepage") to get the the details out of a drop down box i think that you should be able to use... thedropdown.selecteditem.value Papa. i now have an issue about moving on from the page that you open to. i keep getting an error. have posted here. http://www.xtremedotnettalk.com/t77136.html Quote without time nothing ever ends
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.