?
Solved

ASP.NET gridview delete button

Posted on 2012-04-04
2
Medium Priority
?
342 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 2000 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

Stressed Out?

Watch some penguins on the livecam!

Question has a verified solution.

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

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

765 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