2014年7月13日 星期日

[RESOLVED] Radiobutton datakey in gridview


Hi,


I have a radiobutton in gridview:








 





but


   If e.CommandName = "select" Then
TextBox4.Text = e.CommandArgument.ToString()
end if

not work, but this code worked for :


 

but for radiobutton not work, please help me.









Add attribute of gridview onRowCommand="GridView1_RowCommand"



protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)

{


         if(e.CommandName == "Select")


         {


               //Write your code here


         }


}





This code worked for linkbutton. For radiobutton this code not work.

I think require CommandArgument in radiobutton,


How to add this radiobutton?



Instead of firing rowommand event, use radioButton's selectedIndexChanged method where u can get selected value and  you can directly assign that value to textbox...


Just change your approach if possible...


沒有留言:

張貼留言