Question : DropDownBox Null Value

I'm populating a drop down box with a DataTextField="AgentFullName" DataValueField="ID"  This DropDownBox will be used to select the current Manager of an Office.  Sometimes in the Office table the ManagerID is left blank.  When the page loads after going and getting the AgentViewCollection based on the OfficeID and the ManagerID is null for that Office it will cause an error:

System.ArgumentOutOfRangeException: Selection out of range
Parameter name: value

I know there is a setting in these DropDownBox's for such an occasion.  Can anyone tell me what it is?  
Thank You!

Answer : DropDownBox Null Value

You call that method at any point after the control is bound.  An easy place would be in the DataBound event of the DropDownBox control.  I don't know what else occurs in the Edit event, so I can't be sure if that is the proper place.  But if you can determine within that event that the DropDownBox has already been bound, you can call that method.  The important thing is that the method needs to be called *after* the control is bound.

    -dZ.
Random Solutions  
 
programming4us programming4us