asp.net - Check box inside repeater , How to get command name value in the check changed function -


hi have above html tag in asp.net listview item template ,

<td>  <asp:checkbox runat="server" id="chkstudentstatus"  text='<%# getstatusstring(eval("studentstatus").tostring()) %>' commandname='<%#eval("studentid")%>' oncheckedchanged="chkstudentstatus_checkedchanged" checked='<%#eval("studentstatus") %>'  autopostback="true" /> </td> 

while check box value changed command name value in " chkstudentstatus_checkedchanged " function

try this:

short , simple

refrence

your check box

<td>  <asp:checkbox runat="server" id="chkstudentstatus"  text='<%# getstatusstring(eval("studentstatus").tostring()) %>' commandname='<%#eval("studentid")%>' oncheckedchanged="chkstudentstatus_checkedchanged" checked='<%#eval("studentstatus") %>'  autopostback="true" /> </td> 

in code behind

protected void chkstudentstatus_checkedchanged(object sender, eventargs e) {     var chk = (checkbox)sender;     var studentid = chk.attributes["commandname"];   } 

you can give named attribute i.e. xyz='<%#eval("studentid")%>'

than in code behind

protected void chkstudentstatus_checkedchanged(object sender, eventargs e) {     var chk = (checkbox)sender;     var studentid = chk.attributes["xyz"];   } 

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -