asp.net - Eliminate explicit scrolling in a listbox -
i have list box populated via migrating items list box. have 2 asp.net buttons namely , down scroll , down through list box. maximum number of items visible @ time in list box 9, while maximum number of items 21. hence scrollbar comes eventually. pretty evident , ok. if select 21st item , click on button, 21st item moves 1 place above, list shows items first. mean list rearranged, , client has explicitly scroll down list box view 21st item has been moved above.
i want if select item , click button, view of list box should there itself, shouldn't show list box first item.
any appreciated.
below code:
protected void btnthird_click(object sender, eventargs e) { if (lstboxselectedcolumns.selectedindex == 0) { page.clientscript.registerstartupscript(this.gettype(), "alertscrollup", "alertmessage('please select other item scroll or click down navigation button');", true); } else if (lstboxselectedcolumns.selectedindex > 0) { (int = 0; < lstboxselectedcolumns.items.count; i++) { if (lstboxselectedcolumns.items[i].selected) { if (i > 0 && !lstboxselectedcolumns.items[i - 1].selected) { listitem belowitem = lstboxselectedcolumns.items[i]; lstboxselectedcolumns.items.remove(belowitem); lstboxselectedcolumns.items.insert(i-1, belowitem); lstboxselectedcolumns.items[i - 1].selected = true; } } } } else { page.clientscript.registerstartupscript(this.gettype(), "alertselectatleastoneitem2", "alertmessage('please select @ least 1 item scroll above');", true); } }
regards
anurag
Comments
Post a Comment