Solved

how to disable a button on template column in datagridview?

Posted on 2008-10-14
4
679 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
:) hehe thanks a lot ...
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

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…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

744 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

13 Experts available now in Live!

Get 1:1 Help Now