Link to home
Start Free TrialLog in
Avatar of rajeev_23
rajeev_23

asked on

how to disable a button on template column in datagridview?

I have 2 Buttons on a template column of datagridview in webpage of asp.net.
My need is to disable a button on the page load event.

please help
ASKER CERTIFIED SOLUTION
Avatar of Gyanendra Singh
Gyanendra Singh
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rajeev_23
rajeev_23

ASKER

it worked really Thanks Expert , I just changed a little, just the in place of button.disable  it was to be button.enabled=false.
Thanks you all the Experts
This Solution really worked for me with a little change

foreach (GridViewRow row in GridView1.Rows)
        {
            //access the button
            Button cb = (Button)row.FindControl("Button2");
            cb.Enabled = false;
           
            //Button cb1 = (Button)row.FindControl("YourSecondbuttonId");
            //cb1.Disable = true;
 
        }

Open in new window

:) hehe thanks a lot ...