This is a migrated thread and some comments may be shown as answers.

RadGrid object datasource property order

3 Answers 168 Views
Grid
This is a migrated thread and some comments may be shown as answers.
mauro.cecili
Top achievements
Rank 1
mauro.cecili asked on 26 May 2008, 03:56 PM
My datasource is a list of objects.
In some cases objects inherited from a base class:
Example

public partial class Base
{
string Cod;
string Des;
}

public partial Extendend Class:Base
{
string attribute1
string attribute2
string attribute3
}

In thiese cases In my radgrid i obtain this columns result (i need to use automatic generate columns)
attribute1,attribute1,attribute3,Cod,Des

There is a way to obtain a different result?
I want to display this column order:

Cod,Des,attribute1,attribute1,attribute3

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 27 May 2008, 07:03 AM
Hi,

Go through the following help document link.
Changing the grid structure dynamically on postback

Princy.
0
mauro.cecili
Top achievements
Rank 1
answered on 27 May 2008, 07:36 AM
Hi, i have read the example code. It's very useful if i have a specific collection of objects. in my project i use an unique grid to display and filtering data.
Every page use the same grid to handle different list of onbjects so i can't use specific name or attribute for columns, my code should be general.
I need to understand if is possibile to know if an object inherith from a base object and how i can change the dinamically property order or the column order in the grid when i assign the list at the radgrid datasource.

0
Veli
Telerik team
answered on 28 May 2008, 09:53 AM
Hello mauro,

You can try implementing a custom function in your extended class, that will return a DataTable object populated with the data in the order you need. Thus, you can bind your RadGrid DataSource to this function and retrieve the data in correct order for each custom object you create.

Best wishes,
Veli
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
mauro.cecili
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
mauro.cecili
Top achievements
Rank 1
Veli
Telerik team
Share this question
or