473,406 Members | 2,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Help with GridView and an button column

Hi,
I added a buttom column to my gridview. When a certain condition is met I
want to set the visible to True. I did the following but it is not working.

The button column in the page
<asp:ButtonField ButtonType="Image" CommandName="DeleteRow" Visible="false"
">
<ItemStyle HorizontalAlign="Center" />
<HeaderStyle HorizontalAlign="Center" Width="10px" />
</asp:ButtonField>

At the GrrdView RowDataBound Event

Dim _button As ImageButton

If condition Then

_button = e.Row.Cells(1).Controls(0)
_button.Visible = True

End If

Any ideas?
Jan 1 '07 #1
1 3567
Hi,
I have one suggestion.Initially add placeholder control(instead of
ImageButtron and making its visible property false) and let its visible
property be true.

At the GrrdView RowDataBound Event

Dim _button As ImageButton

If condition Then
//First cast it placeholder control and then add imagebuttton to
placeholder
((placeholder)e.Row.Cells(1).Controls(0)).Add.Cont rols(_button)

End If
Altough i have written pseduo code,you can give it try with little
modification.
Hope this helps you out.

Thanks and Regards,
Manish Bafna.
MCP and MCTS.

"Chris" wrote:
Hi,
I added a buttom column to my gridview. When a certain condition is met I
want to set the visible to True. I did the following but it is not working.

The button column in the page
<asp:ButtonField ButtonType="Image" CommandName="DeleteRow" Visible="false"
">
<ItemStyle HorizontalAlign="Center" />
<HeaderStyle HorizontalAlign="Center" Width="10px" />
</asp:ButtonField>

At the GrrdView RowDataBound Event

Dim _button As ImageButton

If condition Then

_button = e.Row.Cells(1).Controls(0)
_button.Visible = True

End If

Any ideas?
Jan 2 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: rufpirat | last post by:
Hello I'm in the middle of trying to build an "AD phone book", and this being my first try at asp.net, I have a few questions that I hope some of you might be able to help with: 1. Is it...
1
by: Miguel Dias Moura | last post by:
Hello, I have a GridView in my page which is created in runtime. It works fine. My page has 2 Asp Buttons: - The HIDE button makes GridView.Visible = False; - The SHOW button makes...
3
by: Rob Roberts | last post by:
Is there any way to add attributes to GridView ButtonFields? I'm looking for a way to add event handlers to ButtonFields. With regular ASP.NET buttons, I can add event handlers by using the...
9
by: hazz | last post by:
I want to display 'n' records for a table-driven data entry page. The first column should be readonly and the 2nd column, a checkbox WRITABLE (NOT READONLY). I can't use the gridview because it...
4
by: bryan | last post by:
Hi all, I am working on a .net 2.0 web app. On page load I display a gridview with a drop down list (Employees), when the user selects from the drop down list, the grid view is filled with...
13
by: AG | last post by:
I have a gridview that I bind to a List(of Type) at runtime. Not using a datasource control. The gridview has a template column with an imagebutton whose commandname is set to 'Delete'. The...
1
by: JB | last post by:
I'm dynamically creating a Gridview object and filling it with contents from an ArrayList as follows: GridView2.AutoGenerateColumns = true; GridView2.DataSource = ArrayListObject;...
2
by: shapper | last post by:
Hello, I am working with a ListView but I suppose that with a GridView might be the same. Instead of having an Insert Button on each GridView row I would like to have only one Insert button,...
1
fayazmd
by: fayazmd | last post by:
Hi, I am creating a webpage having GridView. In GridView i have a column Accolades, a link button column. On clicking of Accolades, a modal window is opened. That modal window has a gridview,...
3
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I have a gridview with several template columns and a few command button columns, column 1 and 2 are dropdown boxes, column 3 is a checkbox and column 4 is a text box, followed by command button...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.