Hello,
if you dont have any problem with your Connection object your problem is due to
binding your grid,for preventing this error you should bind your DropDownList and DataGrid
like below order,
1-first bind your datagrid(before it,set its datasource)
2-then bind again your DropDownList(before it,set its datasource)
for example somewhere like
ItemDataBound event could be a good place for binding DropDownList
meanwhile,its better to use this line in your code,
Code:
if (e.Item.ItemType == ListItemType.Item ||
e.Item.ItemType == ListItemType.AlternatingItem ||
e.Item.ItemType == ListItemType.SelectedItem ||
e.Item.ItemType == ListItemType.EditItem)
{
((DropDownList)e.Item.FindControl ("statusddl")).SelectedIndex = anIntegerVariable;
}
you should put your find method in if-statement for avoiding that error.
HtH.
--------------------------------------------
Mehdi.:)