如何获取checkBox单击按钮的ID? [英] How to get id of checkBox whene button click?
本文介绍了如何获取checkBox单击按钮的ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的先生,
i我检查了5个复选框中的10个然后如何到达那里我是点击按钮....
plz help ...
解决方案
您可以在控件的服务器端迭代,检查是否选中了实际的复选框。
// 您的按钮点击功能
List< ;串GT; yourIds = new List< string>();
CheckBox cb;
foreach ( object actualObject in Controls)
{
if (actualObject.GetType()== typeof (CheckBox))
{
cb = actualObject as CheckBox;
if (cb.Checked)
yourIds.Add(cb.ID);
}
}
您也可以在客户端执行此操作。
试试这个.. :)
(' input:checkbox.class')。each(function(){
var sThisVal =( this 。已检查 ?
Dear sir,
i am checked 5 checkBox out of 10 then how to get there id whene i am click on Button....
plz help...
解决方案
You can iterate through on server side on your controls and check if the actual checkbox checked or not.
//your button click function List<string> yourIds = new List<string>(); CheckBox cb; foreach (object actualObject in Controls) { if (actualObject.GetType() == typeof(CheckBox)) { cb = actualObject as CheckBox; if (cb.Checked) yourIds.Add(cb.ID); } }
You can do this on client side as well.
try this.. :)
('input:checkbox.class').each(function () { var sThisVal = (this.checked ?
这篇关于如何获取checkBox单击按钮的ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文