General information
Title:
DropDownlist initial value
Hi
I've got a dropdownlist in the edittemplate of a listview.
I want to set an initial value for the dropdownlist but can't find it.
I'm trying to set it here.
But this returns null
This isn't all the code but shows where I'm trying to access the dropdownlist.
Any thoughts on the best place to get this value set ?
Thanks Nick
protected void DropDownList2_DataBound(object sender, EventArgs e)
{
DropDownList newstypelkup = GetEditItem(this.ListView1).FindControl("DropDownList2") as DropDownList;
public ListViewItem GetEditItem(ListView listview)
{
if (listview.EditIndex >= 0 && listview.EditIndex < listview.Items.Count)
{
return listview.Items[listview.EditIndex];
}
else
{
return null;
}
}
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only