SelectedIndexChanged RESOLVED
Hi
I have a function "Private Sub fillBoxes(ByVal recordPos As Integer)" which fills several text boxes in the page with the contents of a database table row. RecordPos is the number of the row in the table.
I can call this function in the pageload with fillBoxes(0), or fillBoxes(4) or whatever and it works fine. However, I am trying to call it from the SelectedIndexChanged event of a DropDownList, like this:
Private Sub ddlKey_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ddlKey.SelectedIndexChanged
fillBoxes(ddlKey.SelectedIndex)
End Sub
So basically the user selects a value from the list and the textboxes are filled with the corresponding data row. This throws an exception, however, saying "There is no row at position X". There is nothing wrong with the function as it works fine when I call it in the page load.
Any ideas what could be wrong?
Thanks
Joe
Re: SelectedIndexChanged RESOLVED
Ok, have done.
The problem was that immediately before calling the function, I needed to refill the dataset with the dataadapter. Otherwise, for some still unknown reason, it lost its records when the SelectedIndexChanged event occured.