Solved

ASP.NET GridView Databinding question

Posted on 2010-11-09
3
435 Views
Last Modified: 2012-05-10
I'm actually working with a Telerik RadGrid control, which really just seems to be an extension to the standard ASP.NET GridView control, and I'm assuming that what I need to do is pretty generic and would be done the same way in either case.

I'm databinding a list of objects to the the RadGrid and it is working fine.  The data is coming strait out of the database.  But there is one column that I would like to modify the text of the values in the column.  The value in the database is an abbreviated version of the status and I would like the user to see the unabbreviated version of the status.  I could go through and modify the the data in the list object before I databind it, but I don't want to corrupt the list data in case it is used anywhere else.  There has to be a way somehow for me to do a string.replace when it is populating the datagrid so that I get the grid populated with what I need but so that the original list object remains unaltered.

Can anyone point me in the right direction?
0
Comment
Question by:JosephEricDavis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 41

Accepted Solution

by:
guru_sami earned 500 total points
ID: 34095298
0
 
LVL 8

Expert Comment

by:TheMozz
ID: 34095319
You can do one of a few things, use the ItemDataBound event of the RadGrid - which give you a lot of power over how things are displayed - this is where i do most of my text modifications of list data:
http://www.telerik.com/community/forums/aspnet-ajax/grid/itemdatabound-radgrid.aspx

Another way is to make the column a template column and use an inline expression to do the work. The ItemDataBound event is the better way to go though.

The list data remains intact for both of the ways mentioned.
0
 
LVL 7

Author Closing Comment

by:JosephEricDavis
ID: 34095627
Good deal, thanks a bunch.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question