asp.net - how to set default value of a dropdownlist in VB -


i'm trying set default value of dropdownlist (updatedistributor) in vb.

updatedistributor.datavaluefield doesn't seem work. drop down list remained blank

sub page_load(byval sender object, byval e eventargs)      if not ispostback        dim titlesearch string = "select distrubtorcode titles isbn = 986765654"        dim table datatable = database.selectrows(titlesearch)         if table.rows.count > 0             updatedistributor.datavaluefield = table.rows(0)("distrubtorcode")        end if       end if       dim sqlupdatedistrubtor =  "select distinct distrubtorcode titles "     mydata = database.selectrows(sqlupdatedistrubtor)     each row datarow in mydata.rows         updatedistributor.items.add(new listitem((row)("companyname"), (row)("companyname")))     next  end sub 

in end came - guess placed information in wrong spot before too! combobox.text = "yourtext" worked ! - ty

sub page_load(byval sender object, byval e eventargs)     dim titlesearch string = "select distrubtorcode titles isbn = 986765654"     dim table datatable = database.selectrows(titlesearch)     dim sqlupdatedistrubtor =  "select distinct distrubtorcode titles "    mydata = database.selectrows(sqlupdatedistrubtor)    each row datarow in mydata.rows       updatedistributor.items.add(new listitem((row)("companyname"), (row)("companyname")))    next       if table.rows.count > 0         updatedistributor.text = table.rows(0)("distrubtorcode")     end if  end sub 

Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -