Solved

how to disable a button on template column in datagridview?

Posted on 2008-10-14
4
710 Views
Last Modified: 2013-12-17
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
0
Comment
Question by:rajeev_23
  • 2
  • 2
4 Comments
 
LVL 16

Accepted Solution

by:
Gyanendra Singh earned 500 total points
ID: 22709706
try this


foreach (GridViewRow row in Gridview1.Rows)
{
//access the button
Button cb = (Button )row.FindControl("YouFirstrbuttonId");
cb.Disable = true;
Button cb1 = (Button )row.FindControl("YourSecondbuttonId");
cb1.Disable = true;

}
0
 

Author Closing Comment

by:rajeev_23
ID: 31505807
it worked really Thanks Expert , I just changed a little, just the in place of button.disable  it was to be button.enabled=false.
0
 

Author Comment

by:rajeev_23
ID: 22709776
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

0
 
LVL 16

Expert Comment

by:Gyanendra Singh
ID: 22709826
:) hehe thanks a lot ...
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question