Selecting from gridview to fill dropdownlist

dookie1980

New member
Joined
Jun 8, 2007
Messages
1
Programming Experience
1-3
Hi, im working on some insert/edit/delete forms. Now, i have a form with 3 dropdownlist that depends on each other. To insert i have no problemas at all, i have sqldatasource and using the autopostback feature i works.
Then i have a gridview that select all data from the table im working and allow to select one record and with that, fill the form. In that table i have those 3 codes (idregion, idprovincia, idcomuna)
To load data to the form im using:
VB.NET:
        Dim rowregion As GridViewRow = Me.GridView1.SelectedRow
        Dim lblregion As Label = rowregion.FindControl("region")
        DropDownList3.SelectedValue = lblregion.Text
With that one i have no problema cause it doesnt depend of others, but then i have to fill the next one (provincia), and using the same code i get "'DropDownList4' has a SelectedValue which is invalid because it does not exist in the list of items." Because that the dropdownlist4 depends of the value of the dropdownlist3 after a postback, it doesnt load anything so when i tried to load the selected value i got that error. is there any way to do this?

heres a picture for a better understanding
my.php
 
Last edited by a moderator:
Back
Top