I wanna enable/disable a button found in every row of my grid control. I am not sure how I can access it through code. I would think it would bein the GridView1 methods…..
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can disable the button (or better yet, the entire editing of a specif cell) by just handling the ShowingEditor event… You can then inspect the values of other columns and then cancel the editing of that cell depending on your wishes. Here goes some code for a sample program that shows you exactly how to do that:
This is a pretty simple program. You must assume your button edit column is named gridButtonCol… I’m testing the value of the Even column of the MyData class I’ve created for this sample, you can do whatever you want and check whichever condition you like here.
If you set the e.Cancel property of the CancelEventArgs of the ShowingEditor event, the cell won’t be editable and the button editor won’t respond to user clicks…