Solved

ASP.NET gridview delete button

Posted on 2012-04-04
2
341 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Turn Insights into Action

Communication across every corner of your business is essential to increase the velocity of your application delivery and support pipeline. Automate, standardize, and contextualize your communication processes with xMatters.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

718 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