Solved

how to disable a button on template column in datagridview?

Posted on 2008-10-14
4
691 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
DataGridView Events ? 3 37
vb.net - How to check if current user is an administrator? 6 34
Not showing JavaScript in the list 5 39
Variable Event ? 3 23
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

895 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now