Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to merge columns using Telerik RadGrid control

I know I need to use Template Columns, but I am not clearly understanding how to use it.

I have a datasource which returns a collection, I can assign each property in the collection to a column.

But how do I:

  • Merge two columns? such as col.prop1 +' '+ col.prop2 ?
  • Execute some methods on the properties such as col.prop1.ToString(overloaded)

A simple codebehind example will help. All I can find are very complex controls and stuff for examples..

Thank you.

like image 705
smorhaim Avatar asked Oct 25 '10 16:10

smorhaim


1 Answers

You can also use calculated columns

<telerik:GridCalculatedColumn HeaderText="Test" UniqueName="Test" DataType="System.String"
     DataFields="Field1, Field2" Expression='{0} + " - " + {1}'></telerik:GridCalculatedColumn>

http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/calculatedcolumns/defaultcs.aspx

like image 130
bodee Avatar answered Nov 15 '22 10:11

bodee