Solved

ASP.NET gridview delete button

Posted on 2012-04-04
2
304 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

705 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

15 Experts available now in Live!

Get 1:1 Help Now