回发后使所选项目集中在列表框中 [英] Keeping selected item focused in listbox after postback
本文介绍了回发后使所选项目集中在列表框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I have a listbox with items been filled during runtime. Here how can I keep focus on the selected items in the listbox after postback. I have set multiple selection for the listbox.
I don’t want use coding like this to keep focus every time
int lIntOldIndes = ListBox1.SelectedIndex;
ListBox1.Focus();
ListBox1.SelectedIndex = lIntOldIndes;
Any suggestions please.
Thanks
Sreenath
推荐答案
使用以下代码链接
Use these link of code
if(!IsPostBack)
{
loadlistbox(); //put ur databinding code
}
上面的代码行将帮助u保留列表框的选择.
The above line of code will help u to retain the selection of list box.
这篇关于回发后使所选项目集中在列表框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文