[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 347
  • Last Modified:

ASP.NET gridview delete button

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
zintech
Asked:
zintech
1 Solution
 
Lalit ChandraCommented:
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
 
Manoj PatilSr. Software EngineerCommented:
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

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now