Author: mldesanctis | Posted on: 8/11/2008 9:20:46 AM | Views : 557

I have a SQLDataSource that feeds a table of account names and numbers to a DropDownList which in turn feeds the account number to a ListView to display all related orders.  The dropdownlist has an autopostback to update the ListView - and that works fine.

I then have Page_Load checking to see if there is a QuerySting value that can be parsed into an Int32 and passed to the DropDownList as the SelectedValue.  If the account number exists in the query that the SqlDataSource provides, then it properly selects the correct row.  But as a test, I changed the QueryString value to an Int32 that passes the "string does exist" and "is an Int32" tests, but does not actually exist in the SQL query.  It returns an ArgumentOutOfRangeException.

So I went to the Page_Load() and put the DropDownList1.SelectedValue statement in a try/catch, but with an incorrect value it passes the try, so I guess the exception is not thrown here.

Then ...

Go to the complete details ...