dimanche 5 décembre 2021

Access an HTML input of type checkbox from event rowDataBound

In a asp:gridview i have one input column of type checkbox. im trying to access it from code-behind(vb) because i need to determine visibility = true\false.

The column define like this:

<asp:TemplateField HeaderText=" " ItemStyle-BorderWidth="1" HeaderStyle-Width="3%" ItemStyle-Width="3%" HeaderStyle-CssClass="box_border table_title" ItemStyle-CssClass="box_border">
<ItemTemplate>               
<input type="checkbox" id="chkHaktzaa" onclick="chkHaktzaa_click('<%# Container.DataItemIndex %>')" />
</ItemTemplate>
</asp:TemplateField>

I try to use this method in event rowDataBound:

CType(e.Row.FindControl("chkHaktzaa"), HtmlInputCheckBox).Visible = False

but i get thos error messege:

System.NullReferenceException: Object reference not set to an instance of an object.

Thank you for the help.




Aucun commentaire:

Enregistrer un commentaire