JosephEricDavis
asked on
ASP.NET GridView Databinding question
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?
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?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Good deal, thanks a bunch.
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.