I have a simple admin panel for a table in a db which has a gridview of the indexes from the table, when these are selected it brings up a listview showing the full details for that specific record. These are editable.
I want to restrict the input of edited values quite heavily, and would like to do this with drop down lists for about half of the fields. This is where i've struck a bit of difficulty, having dug around various bits pulled from google I have the standard textbox bound to the field but with visible set to false. Following other examples I then want to set the appropriate value of the dropdownlist on the ItemDataBound Event
i've tried to do this with the following code, but it doesnt seem to be retrieving the dropdownlist, ddl just comes back as null
any ideas would be much appreciated, or a better way of acheiving the same result, I've been chipping away at this for a while but not being able to find the dropdownlist keeps seeming to block me
I want to restrict the input of edited values quite heavily, and would like to do this with drop down lists for about half of the fields. This is where i've struck a bit of difficulty, having dug around various bits pulled from google I have the standard textbox bound to the field but with visible set to false. Following other examples I then want to set the appropriate value of the dropdownlist on the ItemDataBound Event
i've tried to do this with the following code, but it doesnt seem to be retrieving the dropdownlist, ddl just comes back as null
Code:
if (e.Item.ItemType == ListViewItemType.DataItem)
{
DropDownList ddl = (DropDownList)e.Item.FindControl("CampusDDL");
if (ddl != null)
{
ddl.SelectedIndex = ddl.Items.IndexOf(ddl.Items.FindByText(((TextBox)e.Item.FindControl("CampusText")).Text));
}
}
any ideas would be much appreciated, or a better way of acheiving the same result, I've been chipping away at this for a while but not being able to find the dropdownlist keeps seeming to block me