|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
How do I move to a certain value in a dropdown list?
<i><b>Originally posted by : chris parisi (chrisp@usolcomm.com)</b></i><br />I am filling a dropdown list by binding it to a datareader. I then need to be able to move to the specific record in the dropdown. Please help.<br />
|
|
#2
|
|||
|
|||
|
<i><b>Originally posted by : Srinivas</b></i><br /><br />Try datagrid and bind it with your table by<br />passing a parameter as the current value of the<br />dropdown.<br /><br />String selectCmd = "select * from Authors where state = @State";<br /><br /> SqlConnection myConnection = new SqlConnection("server=(local)\NetSDK;database=pubs;Trusted_Connec tion=yes");<br /> SqlDataAdapter myCommand = new SqlDataAdapter(selectCmd, myConnection);<br /><br /> myCommand.SelectCommand.Parameters.Add(new SqlParameter("@State", SqlDbType.NVarChar, 2));<br /> myCommand.SelectCommand.Parameters["@State"].Value = MySelect.Value;<br /><br /> DataSet ds = new DataSet();<br /> myCommand.Fill(ds, "Authors");<br /><br /> MyDataGrid.DataSource= ds.Tables["Authors"].DefaultView;<br /> MyDataGrid.DataBind();<br /><br /><br /><br />------------<br />chris parisi at 3/13/2002 4:16:18 PM<br /><br />I am filling a dropdown list by binding it to a datareader. I then need to be able to move to the specific record in the dropdown. Please help.<br />
|
|
#3
|
|||
|
|||
|
<i><b>Originally posted by : chris parisi (chrisp@usolcomm.com)</b></i><br />Thank you very much for your reply, but maybe you misunderstood me. I am binding a dropdown list to a datareader. Once I have the dropdown filled, I need to move to a specific value in the dropdown list depending on what the user selected on the page before. <br /><br />Any ideas?<br /><br />------------<br />Srinivas at 3/13/2002 8:21:43 PM<br /><br /><br />Try datagrid and bind it with your table by<br />passing a parameter as the current value of the<br />dropdown.<br /><br />String selectCmd = "select * from Authors where state = @State";<br /><br /> SqlConnection myConnection = new SqlConnection("server=(local)\NetSDK;database=pubs;Trusted_Connec tion=yes");<br /> SqlDataAdapter myCommand = new SqlDataAdapter(selectCmd, myConnection);<br /><br /> myCommand.SelectCommand.Parameters.Add(new SqlParameter("@State", SqlDbType.NVarChar, 2));<br /> myCommand.SelectCommand.Parameters["@State"].Value = MySelect.Value;<br /><br /> DataSet ds = new DataSet();<br /> myCommand.Fill(ds, "Authors");<br /><br /> MyDataGrid.DataSource= ds.Tables["Authors"].DefaultView;<br /> MyDataGrid.DataBind();<br /><br /><br /><br />------------<br />chris parisi at 3/13/2002 4:16:18 PM<br /><br />I am filling a dropdown list by binding it to a datareader. I then need to be able to move to the specific record in the dropdown. Please help.<br />
|
|
#4
|
|||
|
|||
|
<i><b>Originally posted by : Ally</b></i><br />dim li as listitem<br />For Each li In cboProviderSkillType.Items<br /> li.Selected = "FALSE"<br /> If li.Value = ValueFromPreviousPage Then<br /> li.Selected = "TRUE"<br /> End If<br />Next<br /><br /><br />------------<br />chris parisi at 3/14/2002 10:24:38 AM<br /><br />Thank you very much for your reply, but maybe you misunderstood me. I am binding a dropdown list to a datareader. Once I have the dropdown filled, I need to move to a specific value in the dropdown list depending on what the user selected on the page before. <br /><br />Any ideas?<br /><br />------------<br />Srinivas at 3/13/2002 8:21:43 PM<br /><br /><br />Try datagrid and bind it with your table by<br />passing a parameter as the current value of the<br />dropdown.<br /><br />String selectCmd = "select * from Authors where state = @State";<br /><br /> SqlConnection myConnection = new SqlConnection("server=(local)\NetSDK;database=pubs;Trusted_Connec tion=yes");<br /> SqlDataAdapter myCommand = new SqlDataAdapter(selectCmd, myConnection);<br /><br /> myCommand.SelectCommand.Parameters.Add(new SqlParameter("@State", SqlDbType.NVarChar, 2));<br /> myCommand.SelectCommand.Parameters["@State"].Value = MySelect.Value;<br /><br /> DataSet ds = new DataSet();<br /> myCommand.Fill(ds, "Authors");<br /><br /> MyDataGrid.DataSource= ds.Tables["Authors"].DefaultView;<br /> MyDataGrid.DataBind();<br /><br /><br /><br />------------<br />chris parisi at 3/13/2002 4:16:18 PM<br /><br />I am filling a dropdown list by binding it to a datareader. I then need to be able to move to the specific record in the dropdown. Please help.<br />
|
![]() |
| Viewing: ASP Free Forums > Programming > .NET Development > How do I move to a certain value in a dropdown list? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|