Checkboxlist检查/取消选中事件 [英] Checkboxlist check/uncheck event
问题描述
我有一个复选框列表
< asp:CheckBoxList id =check1AutoPostBackTrueTextAlignRightOnSelectedIndexChanged =Checkrunatserver >
功能:
子检查(ByVal发送者为对象,ByVal e As EventArgs)
Dim sql As String
如果check1.SelectedItem。 Selected = True然后[code] ....
错误是:对象引用未设置为对象的实例。有没有更好的方法来检查列表项是否已选中或未选中?
I have a checkboxlist
<asp:CheckBoxList id="check1" AutoPostBack"True" TextAlign"Right" OnSelectedIndexChanged="Check" runat"server">
And the function:
Sub Check(ByVal sender As Object, ByVal e As EventArgs)
Dim sql As String
If check1.SelectedItem.Selected = True Then[code]....
The error is: Object reference not set to an instance of an object. Is there a better way to check if a list item is checked or unchecked?
推荐答案
尝试以下
Try the following
if (Checkboxlist1.Items[Index].Selected)
{
Response.Write("Try this");
}
这篇关于Checkboxlist检查/取消选中事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!