asp.net - DropDownList - Retrieving Data from Database - Disappear After AutoPostBack -
my dropdownlist1
retrieves info column in database, on same page, have dropdownlist2
when selecting value, fire autopostback
, problem running is,
if select value dropdownlist1
, value un-selected when autopostback
happens, how can create dropdownlist
keeps selected value when autopostback
fired?
thank you
you must binding dropdownlist1
in page_load
event. in case, should create sure should bind first time , not every time using ispostback
property below, otherwise every time info db , re-populate dropdownlist.
protected void page_load(object sender, eventargs e) { if(!ispostback) { //bind dropdownlist1 } }
asp.net .net drop-down-menu
No comments:
Post a Comment