|
| I have a GridView - gv and an ObjectDataSources - ods. I've configured ods
to get data from tblMenu that has intMenuID as pk and a column called
intParentMenuID - pointing to intMenuID. So the values could be:
intMenuID intParentMenuID
----------- -------------------
1 0
2 0
3 1
....
On gv, I have two templated fields, menu name and parent menu name. In
EditItemTemplate for parent menu name, i have a DropDownList - ddl. I've got
the same ods as my DataSource. In "Select a data field to display", I have
vcMenuName and in "Select a data field for the value", I have intMenuID.
I've also bound my column (by selecting Edit DataBindings) to
intParentMenuID. So my source has Bind("intParentMenuID").
When I run my page and select a row where the parent menu is non-blank (the
third row in our case), I get "Specified argument was out of the range of
valid values. Parameter name: 1". If I remove the data bindings, the code
runs fine but the item is not selected in my ddl and I don't want this
behavior.
|
|