Solved

Hiding an image button in a gridview

Posted on 2011-02-21
3
696 Views
Last Modified: 2012-05-11
hey all

I have a gridview table that are filled with a sql database. I also have a small image button of a pencil to signify "edit"

I would like to hide the edit button on some rows depedning on the value of the field

It is a time management system where users edit their overtime, if the status is "new" then they can edit, but if its "submitted" then I would like to hide the edit button but since its row dependant where can I do that?

<ItemTemplate>
                                <asp:ImageButton
                                    ID="ImageButton1"
                                    runat="server"
                                    CausesValidation="False"
                                    OnClick="editButton_Click"
                                    CommandArgument='<%# Eval("OvertimeID") %>'    
                                    SkinID="Edit"
                                    Text="Edit" />
                            </ItemTemplate>

Open in new window

0
Comment
Question by:samelamin
[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
3 Comments
 
LVL 22

Expert Comment

by:pivar
ID: 34942534
Hi,

Have you tried something like:


Visible='<%# Eval("Status").ToString().Equals("new") %>'

/peter
0
 
LVL 13

Accepted Solution

by:
agarwalrahul earned 500 total points
ID: 34942545
you can put this code in gridview_rowdatboundevent:

 If e.Row.Cells(4).Text.Trim = "Condition" Then
                    ImageButton1.Visible = False
                End If
0
 

Author Closing Comment

by:samelamin
ID: 34942617
That worked thanks
0

Featured Post

More Than Just A Video Library

Train for your certification. Learn the latest DevOps tools. Grow your skillset to do better work.

At Linux Academy, we release new training modules every week so you'll always be up to date on the latest tech.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

707 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