-
Junior Member
DropDown in DataList
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 11:23 AM.
-
Contributing Member
Re: DropDown in DataList
Check whether the ValueField has unique values or not....
-------------------
suresh
-
Junior Member
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
{
}
}
}
-
Junior Member
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
-
Junior Member
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
{
}
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules