Solved

ASP.NET gridview delete button

Posted on 2012-04-04
2
322 Views
Last Modified: 2012-08-13
I was just wondering if there is any way to put the Delete button on an ASP.NET gridview conditionally based on a specific condition
0
Comment
Question by:zintech
2 Comments
 
LVL 7

Accepted Solution

by:
Lalit Chandra earned 500 total points
ID: 37806806
You need to handle the  OnRowDataBound event of gridview manually. like
<asp:GridView ID="GridView1" runat="server"
            .. OnRowDataBound="GridView1_RowDataBound">

Now, in code behind,you can write

protected void GridView1_RowDataBound(object sender,
        System.Web.UI.WebControls.GridViewRowEventArgs e)
    {
        if ((e.Row.RowType == DataControlRowType.DataRow)
        {
            LinkButton selectButton = (LinkButton)e.Row.FindControl("LinkButtonSelect");
            if (selectButton != null)    // YOUR Logic to display
                selectButton.Visible = false;
          }
    }


For More but brief knowledge you can refer below quick link

http://forums.asp.net/t/1449959.aspx/1


Hope this would help you to resolve your problem.
0
 
LVL 19

Expert Comment

by:Manoj Patil
ID: 37807104
Hi see this tutorial. Will give you the Best description for GridView Operations

http://msdn.microsoft.com/en-us/library/bb498195.aspx
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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

831 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