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
Post a Comment