c# - how to add event handler to programatically created checkboxes -


this code adding check box progrmatically doesnt let me add event onchecked

protected void gridview1_rowdatabound(object sender, gridviewroweventargs e) {          checkbox chk = new checkbox();         chk.enableviewstate = true;         chk.enabled = true;          chk.id = "chkb";         datarowview dr = (datarowview)e.row.dataitem;           e.row.cells[0].controls.add(chk);          e.row.tablesection = tablerowsection.tablebody;     } 

when try add this:

chk.checkedchanged += checkbox_checkedchanged; error :  "the name 'checkbox_checkedchanged' not exist in current context", 

even though have added function:

   private void checkbox_checkedchanged(object sender, system.eventargs e)   {    response.write("in check changed object");   } 

c# case-sensitive. function named checkbox_checkedchanged, attempting attach event handler function named checkbox_checkedchanged (note upper- vs. lowercase "c" @ beginning).


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -