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:

  1. control postback i.e. oncheckedchanged: sender object checkbox
  2. row event e.g. onitemdatabound, onrowinsert, etc: can hold of checkbox using e.item.findcontrol("addcb");

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -