Solved

ASP.NET GridView Databinding question

Posted on 2010-11-09
3
423 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
3 Comments
 
LVL 41

Accepted Solution

by:
guru_sami earned 500 total points
Comment Utility
0
 
LVL 8

Expert Comment

by:TheMozz
Comment Utility
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
Comment Utility
Good deal, thanks a bunch.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Hovering effect 9 27
DataGridview Currency Formating? 22 37
Long URL in SMS 6 20
Format column on datatable 7 13
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

728 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now