473,511 Members | 14,393 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is there any way to affect gridview row appearance based on contents?

I have a gridview with a button that should only appear if the
database routine it is based on returns a value of 'True' for the
database field "ReservationsExist". So I tried putting in the
following:

<asp:ButtonField ButtonType="Button"
CommandName="Reservations"
HeaderText="View Reserves"
Text="View Reserves" Visible='<%#
Eval("ReservationsExist") %>' />

This does not work. I get an error message saying that ButtonFields
don't have a 'DataBinding' event, and therefore I can't do this.
Is there some way of doing this? In general it would enhance a
gridview if you could do things like this.
-- Thanks,
Marv.
Jun 27 '08 #1
1 1209
You can override the GridView's DataBound event and modify things there.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

<CO*********@lycos.comwrote in message
news:61**********************************@s50g2000 hsb.googlegroups.com...
>I have a gridview with a button that should only appear if the
database routine it is based on returns a value of 'True' for the
database field "ReservationsExist". So I tried putting in the
following:

<asp:ButtonField ButtonType="Button"
CommandName="Reservations"
HeaderText="View Reserves"
Text="View Reserves" Visible='<%#
Eval("ReservationsExist") %>' />

This does not work. I get an error message saying that ButtonFields
don't have a 'DataBinding' event, and therefore I can't do this.
Is there some way of doing this? In general it would enhance a
gridview if you could do things like this.
-- Thanks,
Marv.
Jun 27 '08 #2

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

Similar topics

3
5659
by: theKirk | last post by:
using Visual Studio 2005 C# ASP.NET I know there has to be a simple way to do this....I want to use C# in a code behind for aspx. Populate a GridView from an xml file Add Fields to the...
4
13476
by: Jim Katz | last post by:
I have an application that updates a strongly typed data set at run time. I'd like to dynamically create a table that connects to a run time data table. For displaying the data, this works well. ...
1
1649
by: Andrew Nav | last post by:
I dragged a table from a datasource on to my web form and the GridView cpntrol was created. I turned on paging, and Edit and Delete buttons. I ran the app and everything worked great - not a...
2
2015
by: ad | last post by:
I use a pre-defined CSS to my webpage. There are many class in the CSS. The header of my GridView will be affected by the CSS, but I can't find the class which affect the header of the GridView. ...
6
3450
by: CSharpguy | last post by:
In my gridview I have 2 -3 template fields which are hyperlinks. I allow the user to print this grid. When the grid prints it also prints the links, how can I take the user to a print preview page...
0
4330
by: troyblakely | last post by:
I have a gridview which is pulling data from a SqlDataSource, the select command queries a view and the update command is a stored procedure. I'm using a stored procedure because several tables...
11
8843
by: HEX | last post by:
Have a page developed w/VWD which has a Gridview control. XHTML 1.0 Transitional Doctype. Tested in VWD OK and renders in IE7 as tested. When rendered with Firefox, the Gridview is shifted far to the...
2
3921
by: =?Utf-8?B?SkRSYXZlbg==?= | last post by:
I have searched all over and can not seem to find an effective way to simply copy the contents of a ASP:gridview column to the clipboard based on a button or similar HTML or ASP.NET control. ASP...
4
10989
by: Craig Buchanan | last post by:
I dynamically add data-bound templates to a gridview in my ascx control. while this works correctly when the gridview is databound to the datatable, i'm having issues on postback. i would like...
0
7251
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
7367
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7089
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
7517
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3217
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1581
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
790
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.