473,385 Members | 1,396 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,385 software developers and data experts.

GridView Text Value Mapping - ASP.NET

29
Hey Everyone,

I have a SqlDataSource hooked into a gridview. In the database I have a boolean property. It shows up in the gridview as true but I want to say something else. What is the best way to set if row.cell(0).text = "True" row.cell(0).text = "Finished"

Kind of like drop down list has a value text mapping.

Thanks
Nov 7 '08 #1
2 1496
jhardman
3,406 Expert 2GB
I'm assuming that you are writing in ASP.NET, since "classic" ASP does not support gridviews. I have moved your post to the .NET forum because the ASP forum is for "classic" ASP only.

Anyway, I think you are looking for a ivalueconverter, hopefully a .NET expert can clarify.

Jared
Nov 8 '08 #2
mldisibio
190 Expert 100+
There IS a way to handle this, but I have been away from ASP.Net so long I will let someone else answer directly. Nonetheless, I wanted to throw out another approach, if it works for you:

If the data is basically display only, can you change the sql which pulls it? This would solve your problem before it gets to the Grid.

Assuming your source column in SqlServer is a bit, then you can pull that column like this (call it col2):
Expand|Select|Wrap|Line Numbers
  1. SELECT
  2.  col1 as FirstColumn,
  3.  CASE col2 
  4.    WHEN 0 THEN 'Unfinished'  ELSE 'Finished' 
  5.  END as SecondColumn
  6. FROM MyTable
  7.  
Again, you may not be able to change the sql, or you may not want to for other design reasons. Just a suggestion.
Nov 9 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Mike Kelly | last post by:
I've chosen to implement the "optimistic concurrency" model in my application. To assist in that, I've added a ROWVERSION (TIMESTAMP) column to my main tables. I read the value of the column in my...
1
by: John_H | last post by:
Re: ASP.NET 2.0 I would like suggestions or code examples on how to collect a variable length list of input data (item# & item quantity specifically). I thought that I could accomplish this...
5
by: Dick | last post by:
I have a GridView bound to an ObjectDataSource. I have a Button that calls GridView.DataBind. I want the row that is selected before the DataBind to still be selected afterwards. This happens...
1
by: tfsmag | last post by:
Hello, I have a function that returns a dynamically created gridview. This works fine, however it does not seem to be able to maintain state when adding sorting or paging to the gridview. Does...
1
by: DC | last post by:
The problem I'm using the .NET GridView and FormView objects for the first time and im getting the error "An OleDbParameter with ParameterName '@ID' is not contained by this...
7
by: =?Utf-8?B?cGF0cmlja2RyZA==?= | last post by:
Hi all! I have a gridview inside a datagrid (nested) for which (gridview) the rowcommand is not raised in order to delete a row from the grid! I also tried OnRowCommand="method", didn't work...
2
by: Blasting Cap | last post by:
I've got a gridview (that I converted over from a datagrid, which had been working properly), that is doubling up the number of rows returned. When it was running as a datagrid, the same code sent...
4
by: =?Utf-8?B?QmFyYmFyYSBBbGRlcnRvbg==?= | last post by:
I setup a simple gridview as a utility just to do some updates, nothing fancy just wanted easy UI to make updates. When I select ‘Edit’, I get the fields I want to edit. I edit them and click...
2
by: jayesch | last post by:
I am using data sets in my project to fetch data from Access database and I bind these dataset APIs to gridview. My problem is - I have certain boolean data and numerical data that I need to map it...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.