使用C#在“更新”面板中的gridview中查找HTML复选框ID [英] Find HTML check box id in gridview in Update panel using C#

查看:92
本文介绍了使用C#在“更新”面板中的gridview中查找HTML复选框ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个gridview在更新面板下。我在我的项目模板中放置了HTML输入复选框。现在我想在gridview页面索引更改事件中找到此复选框ID。我无法找到它的show null对象。



我喜欢gridview页面索引中的这段代码。我尝试了几种方法,但没有打算复选框的ID。



foreach(mygrid.rows中的GridViewRow行)

{

HtmlInputCheckBox chk =(HtmlInputCheckBox)row.FindControl(chkBulk); //空引用

CheckBox chk =(CheckBox)(row.Cells [0] .FindControl(chkBulk)); // null reference

}



复选框控件中没有runat =server。我不要求,

< itemtemplate>

< input id =chkBulktype =Checkboxclass =SingleönClick=SetRowColor(这个)/>





我只需要输入我的Jquery函数复选框。现在我需要查找天气此输入复选框是否已选中。



请帮助解决此问题。

解决方案

< blockquote>是的,你应该使用runat = server


Hi All,
I have a gridview Under update panel. I placed HTML input checkbox in my Item template. Now i want to find this checkbox id in gridview page Index changing event. I am uanble find always its shows null object.

I user like this code in gridview page index. I tried serveral ways, but not geeting the id of checkbox.

foreach (GridViewRow row in mygrid.rows)
{
HtmlInputCheckBox chk = (HtmlInputCheckBox)row.FindControl("chkBulk"); // Null reference
CheckBox chk = (CheckBox)(row.Cells[0].FindControl("chkBulk")); // null reference
}

There is no runat="server" in check box control. I don't require that,
<itemtemplate>
<input id="chkBulk" type="Checkbox" class="Single" önClick="SetRowColor(this)"/>


I need only input check box for my Jquery functions. Now I need to find weather this input checkbox checked or not.

Please help in this issue.

解决方案

yes, you should use runat=server


这篇关于使用C#在“更新”面板中的gridview中查找HTML复选框ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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