检查里面的中继箱,在检查如何获得命令名称值更改的功能 [英] Check box inside repeater , How to get command name value in the check changed function
本文介绍了检查里面的中继箱,在检查如何获得命令名称值更改的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
HI我上面HTML标记在我的asp.net列表视图项模板,
HI i have above html tag in my asp.net listview item template ,
<td>
<asp:CheckBox runat="server" ID="chkStudentStatus" Text='<%# GetStatusString(Eval("StudentStatus").ToString()) %>' CommandName='<%#Eval("StudentID")%>' OnCheckedChanged="chkStudentStatus_CheckedChanged" Checked='<%#Eval("StudentStatus") %>' AutoPostBack="True" />
</td>
虽然复选框值改变了我是在chkStudentStatus_CheckedChanged功能来获取命令名称值
While check box value changed i was to get the Command Name value in the " chkStudentStatus_CheckedChanged " function
推荐答案
试试这个:
简短
Refrence
您的复选框
<td>
<asp:CheckBox runat="server" ID="chkStudentStatus" Text='<%# GetStatusString(Eval("StudentStatus").ToString()) %>' CommandName='<%#Eval("StudentID")%>' OnCheckedChanged="chkStudentStatus_CheckedChanged" Checked='<%#Eval("StudentStatus") %>' AutoPostBack="True" />
</td>
在code后面
protected void chkStudentStatus_CheckedChanged(object sender, EventArgs e)
{
var chk = (CheckBox)sender;
var studentID = chk.Attributes["CommandName"];
}
您可以给任何指定的属性即 XYZ ='&LT;%#的eval(StudentID)%>
you can give any named attribute i.e. xyz='<%#Eval("StudentID")%>'
比
在后面
protected void chkStudentStatus_CheckedChanged(object sender, EventArgs e)
{
var chk = (CheckBox)sender;
var studentID = chk.Attributes["xyz"];
}
这篇关于检查里面的中继箱,在检查如何获得命令名称值更改的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文