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

后端 未结 2 519
伪装坚强ぢ
伪装坚强ぢ 2021-01-18 17:11

HI i have above html tag in my asp.net listview item template ,

 


        
2条回答
  •  感动是毒
    2021-01-18 18:09

    try this:

    Short and simple

    Refrence

    your check box

     
    
    
    

    in code behind

    protected void chkStudentStatus_CheckedChanged(object sender, EventArgs e)
    {
        var chk = (CheckBox)sender;
        var studentID = chk.Attributes["CommandName"];
    
    
    }
    

    you can give any 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"];
    
    
    }
    

提交回复
热议问题