ASPX ListBox自动选择第一项 [英] ASPX ListBox AutoSelect First Item

查看:102
本文介绍了ASPX ListBox自动选择第一项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我想知道是否有人可以帮我忙这个正在进行的项目,现在我需要在单击不同列表框上的项目后自动选择列表框上的第一项.

我正在Aspx工作,谢谢.

最好的问候

Hello,

I was wondering if someone could give me a hand in this project that im working on, right now i need to auto-select the first item on a listbox after i click an item on a diferent listbox.

Im working in Aspx , thank you.

Best Regards

推荐答案


如果需要选择第一个值",则必须设置SelectedIndex
Hi ,
If you need to select the First Value you have to set SelectedIndex
ListBox1.SelectedIndex = 0;


最好的问候
M.Mitwalli


Best Regards
M.Mitwalli


ListBox1.SelectedIndex = 0;



是正确的答案,您应该用C#代码编写.

如果您想使用JS

那么你可以使用



is the right answer and you should write in in C# code.

if you want to use JS

then you can use

document.getElementById("ListBox1").selectedIndex = 0;



在页面底部



at then bottom of page


这篇关于ASPX ListBox自动选择第一项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆