asp.net - accessing control/Checkbox in editform -
i have problem accessing checkbox
in editform-template, nested in grid.
<editformsettings editformtype="template" editcolumn-uniquename="insertform"> <formtemplate> <table> <tr> <td>add : </td> <td> <asp:checkbox runat="server" id="addcb" /> </td> </tr> <tr> </table> </formtemplate> </editformsettings>
the editformtemplate said, nested in grid. didn`t post here, make more clearly.
my problem neither can access checkbox via javascript :
function isaddswitched() { var checkbox = $find("<%= addcb.clientid%>"); alert(checkbox.get_checked()); }
nor can access through code behind :
if addcb.checked 'code here end if
when move checkbox out of template field no problem @ all. inside it, seems impossible access it.
it greatif me problem !!
kind regards,
malte
this because when controls placed in grid, not declared in designer file page controls.
you have hold of them differently depending on event happening:
- control postback i.e. oncheckedchanged: sender object checkbox
- row event e.g. onitemdatabound, onrowinsert, etc: can hold of checkbox using e.item.findcontrol("addcb");