Prepare for your Next Interview
|
Welcome to the Geeks Talk forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
This is a discussion on DropDown in DataList within the ASP.NET forums, part of the Web Development category; I have datalist and in the Item template i have taken a dropdown list in a ASP.NET 1.1 web application. I have populated the dropdown at runtime. Now i want ...
|
|||||||
|
|||
|
I have datalist and in the Item template i have taken a dropdown list in a ASP.NET 1.1 web application. I have populated the dropdown at runtime. Now i want to capture the value selected in the DropDown. I tried SelectedIndexChanged procedure of the DropDown and the DataList and ItemCommand of DataList but to no avail. These events are being fired but i have no clue on how to capture the value selected in the DropDown List..... When an item in the drop Down is selected then the ItemCommand event of the datalist isnt triggered.....Please Help.
Thanks in Advance. Sreedevi
Last edited by Sreedevi Pidaparthi; 06-26-2007 at 12:23 PM. |
| Sponsored Links |
|
|||
|
Re: DropDown in DataList
protected void drp1_SelectedIndexChanged(object sender, EventArgs e)
{ DropDownList ddl = (DropDownList)sender; string contactid = ddl.SelectedIndex.ToString(); // to access any other element in datalist // DataListItem row = ddl.NamingContainer as DataListItem; //Label lbl = (Label)row.FindControl("lbl_text"); if (ddl.SelectedItem.Text != "-Select-") { .... } else { } } } |
|
|||
|
Re: DropDown in DataList
protected void drp1_SelectedIndexChanged(object sender, EventArgs e)
{ string selectedValue=drp1.SelectedValue.ToString().Trim(); //Do rest of the code } this will help u to get the selected value from the drop down list |
|
|||
|
Re: DropDown in DataList
protected void drp1_SelectedIndexChanged(object sender, EventArgs e)
{ DropDownList ddl = (DropDownList)sender; string contactid = ddl.SelectedIndex.ToString(); // to access any other element in datalist // DataListItem row = ddl.NamingContainer as DataListItem; //Label lbl = (Label)row.FindControl("lbl_text"); if (ddl.SelectedItem.Text != "-Select-") { .... } else { } } } |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| ADO.NET 2.0 : Check Box and Dropdown List in a Datagrid | Srikanth | VB.NET | 2 | 02-19-2007 02:14 PM |