G
Guest
Hi folks,
I have a DropDownList in a DataGrid that is populated from records in a
database.
I want to add a value that might be a string such as "Select a Company" for
the first item since an OnSelectedIndex event is not fired if you select the
first item.
Does anyone know of an easy way to do this?
I am using the following code to get at the the dropdownlist that is inside
a cell within the datagrid which is placed inside my PageLoad function:
Dim list As DropDownList = New DropDownList ( )
Dim cell As TableCell = CType(list.Parent, TableCell)
Dim item As DataGridItem = CType(cell.Parent, DataGridItem)
Dim ddlCo As DropDownList = CType(item.FindControl("ddlCo"), DropDownList)
ddlCo .Items.Add("Select a Company")
I am getting the infamous "object reference not set to an instance of an
object" on the Dim item line...
Appreciate any replies...
glenn
I have a DropDownList in a DataGrid that is populated from records in a
database.
I want to add a value that might be a string such as "Select a Company" for
the first item since an OnSelectedIndex event is not fired if you select the
first item.
Does anyone know of an easy way to do this?
I am using the following code to get at the the dropdownlist that is inside
a cell within the datagrid which is placed inside my PageLoad function:
Dim list As DropDownList = New DropDownList ( )
Dim cell As TableCell = CType(list.Parent, TableCell)
Dim item As DataGridItem = CType(cell.Parent, DataGridItem)
Dim ddlCo As DropDownList = CType(item.FindControl("ddlCo"), DropDownList)
ddlCo .Items.Add("Select a Company")
I am getting the infamous "object reference not set to an instance of an
object" on the Dim item line...
Appreciate any replies...
glenn