Wrox Programmer Forums
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 16th, 2003, 04:50 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default Data grid bound column

Hello,

I have a data grid control. One of the fields (of the SQL Server data source for the control) is a code value:

T = Valid
F = Invalid

Instead of displaying the T/F, I want to display Valid/Invalid. How can I do this manually? Do I use a template column field?

Thanks,

Brian Mains
__________________
Brian
 
Old December 17th, 2003, 07:12 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Can you modify the query? I'd say the easiest way would be to change the query to return the desired values:

SELECT ..., CASE tfField WHEN 'T' THEN 'Valid' ELSE 'Invalid' END AS tfField ...

Peter
------------------------------------------------------
Work smarter, not harder.
 
Old December 18th, 2003, 05:54 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

I was wondering if the databindings event would handle this... Not necessarily for the data grid, but for other uses (such as binding a label or textbox), would the data bindings event handle what I wanted to do?

Thanks.
 
Old December 18th, 2003, 06:04 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

The OnItemDataBound event of the datagrid will fire for each item that's created and bound. Potentially, you could look in the grid for the code value and translate it into your desired string. (remember though that the header and footer of the grid are also bound so you have to skip those items in the handler.)

Peter
------------------------------------------------------
Work smarter, not harder.





Similar Threads
Thread Thread Starter Forum Replies Last Post
export data grid hyperlink column to excel phyzie VS.NET 2002/2003 0 April 16th, 2007 01:45 AM
How to sort a column in data grid: kenn_rosie ASP.NET 1.0 and 1.1 Basics 1 January 26th, 2006 02:03 PM
template column and bound column hidayah ASP.NET 1.x and 2.0 Application Design 1 April 9th, 2005 03:50 PM
How do you make a Data Grid Hyperlink Column pass KarmenC ASP.NET 1.x and 2.0 Application Design 5 January 13th, 2005 11:43 AM
Data Grid Drop Down List Column bmains ASP.NET 1.0 and 1.1 Professional 4 September 21st, 2004 08:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.