javascript - How to execute method on listbox item select asp.net -
need select item listbox , on select method executed load_data() , data loaded , displayed instead after page gets refreshed , again value displayed set default . autopostback property true . should ?
protected void listbox1_selectedindexchanged1(object sender, eventargs e) { load_data(listbox1.selecteditem.text); }
if databinding listbox in page_load
method, make sure databind when it's not postback this...
protected void page_load(object sender, eventargs e) { if (!page.ispostback) { // initial databind listbox here (where default data loaded) } }
you can still keep selectedindexchanged event
protected void listbox1_selectedindexchanged1(object sender, eventargs e) { load_data(listbox1.selecteditem.text); }
Comments
Post a Comment