473,672 Members | 2,597 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 "ReservationsEx ist". So I tried putting in the
following:

<asp:ButtonFiel d ButtonType="But ton"
CommandName="Re servations"
HeaderText="Vie w Reserves"
Text="View Reserves" Visible='<%#
Eval("Reservati onsExist") %>' />

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 1220
You can override the GridView's DataBound event and modify things there.

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

<CO*********@ly cos.comwrote in message
news:61******** *************** ***********@s50 g2000hsb.google groups.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 "ReservationsEx ist". So I tried putting in the
following:

<asp:ButtonFiel d ButtonType="But ton"
CommandName="Re servations"
HeaderText="Vie w Reserves"
Text="View Reserves" Visible='<%#
Eval("Reservati onsExist") %>' />

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
5673
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 GridView to allow entry of quantity and Y/N switch for
4
13485
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. I just set the GridView.DataSource once, and call DataBind(); I'd like to drive the application from the GridView control, by including command buttons that allow editing of the data. Starting out simple, I have a DataTable with a boolean...
1
1653
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 single line of code written yet. Then I wanted to add a simple feature where the user could filter out data based on a value in a single column. I added a little code that set the FilterExpression property of the SqlDataSource, and that seemed...
2
2021
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. What class in CSS affect the head of GridView?
6
3462
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 and not show the templated fields, (hyperlinks) and also not print those fields?
0
4340
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 need to be updated based on the data in the gridview. <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:slightsInventoryConnectionString %>" SelectCommand="SELECT * FROM " UpdateCommand="upd_Inventory"...
11
8863
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 right. It is set as absolute and it appears Firefox is not doing the position based upon the Left: setting. Fussed with different changes to page trying to figure this out to no avail. The view source from both browsers is practically identical. The...
2
3929
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 2.0 web application with VB.NET code developing in Visual Studio 2005 Pro. Gridview has several columns, and users need the ability to copy one of the columns to the clipboard for pasting into a separate app (that already has the ability to...
4
11004
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 to iterate thru the gridview's rows, examine the databound controls, then perform a database action. for some reason, i can't find the controls. i have a two templates: one that uses a label the other uses a textbox to display data. when the...
0
8404
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8608
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8680
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7446
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5705
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4227
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4418
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2819
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 we have to send another system
2
2063
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.