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

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -