如何在客户端处理SelectedIndexChanged事件 [英] How to handle the SelectedIndexChanged event in client side
本文介绍了如何在客户端处理SelectedIndexChanged事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我有RadioButtonList和面板.当我在列表中选择特定项目时,我想使面板可见.我将此代码写在代码隐藏文件中,如下所示:
Hi all,
I have RadioButtonList and Panel. I want to make a panel visible when I choose a specific item in the list. I wrote this code in the code-behind file like this:
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (RadioButtonList1.SelectedIndex == 3)
Panel1.Visible = true;
else
Panel1.Visible = false;
}
如何在客户端实现此功能?如果有多种方法,请提及它们.
在此先谢谢您.
How can I implement this in the client side? if there are more than one way please mention them.
Thanks in advance.
推荐答案
请确保已在代码内设置了AutoPostBack="true"
.
然后在客户端脚本中编写此代码.
请参见示例此处 [
Make sure you have setAutoPostBack="true"
inside the code.
Then write this code inside a client script.
See the example here[^].
从以下链接获取帮助,
http://www.a2zmenu.com/Blogs/AspNet/Client-side-onselectedindexchanged-or-onchange-event-in-RadioButtonList.aspx [ http://stackoverflow.com/questions/579597/how-can-i-determine-the-selected-of-a-radiobuttonlist-in-javascript [ ^ ]
http://stackoverflow.com/questions/2473897/jquery- select-item-in-radiobuttonlist-via-client-side-function [ http://codeasp.net/blogs/raghav_khunger/microsoft- net/716/jquery-set-selected-item-of-radiobuttonlist [
get help from the following links,
http://www.a2zmenu.com/Blogs/AspNet/Client-side-onselectedindexchanged-or-onchange-event-in-RadioButtonList.aspx[^]
http://stackoverflow.com/questions/579597/how-can-i-determine-the-selectedvalue-of-a-radiobuttonlist-in-javascript[^]
http://stackoverflow.com/questions/2473897/jquery-select-item-in-radiobuttonlist-via-client-side-function[^]
http://codeasp.net/blogs/raghav_khunger/microsoft-net/716/jquery-set-selected-item-of-radiobuttonlist[^]
None of the above links will provide your desired solution but combined concept will show you the way to solve your problem.
这篇关于如何在客户端处理SelectedIndexChanged事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文