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

custom xml - cell customization

1 Answer 34 Views
Grid
This is a migrated thread and some comments may be shown as answers.
tasos
Top achievements
Rank 1
tasos asked on 04 Nov 2010, 02:00 PM
Hello.
<Rows>
            <Row>
                <Cell>
                    <DataType>1</DataType>
                    <ObjectType>2</ObjectType>
                    <ObjectID>6212</ObjectID>
                    <Value><![CDATA[1 Row 1 cell]]></Value>
                </Cell>
                <Cell>
                    <DataType>1</DataType>
                    <ObjectType></ObjectType>
                </Cell>
                <Cell>
                    <DataType>1</DataType>
......
Columns
   <Columns>
        <Column>
            <ID><![CDATA[74]]></ID>
            <Sorting><![CDATA[ASC]]></Sorting>
            <SortingOrder><![CDATA[1]]></SortingOrder>
            <FieldName><![CDATA[EventName_Main]]></FieldName>
            <Label><![CDATA[foo]]></Label>
            <DataType><![CDATA[1]]></DataType>
            <PositionInList><![CDATA[155]]></PositionInList>
        </Column>
        <Column>
            <ID><![CDATA[518]]></ID>
            <Sorting><![CDATA[]]></Sorting>
            <SortingOrder><![CDATA[100]]></SortingOrder>
            <FieldName><![CDATA[Name_Rel513]]></FieldName>
            <Label><![CDATA[foobar]></Label>
            <DataType><![CDATA[1]]></DataType>
            <PositionInList><![CDATA[156]]></PositionInList>
        </Column>
..........

So i would like to create a grid(in order to perform sorting,grouping etc).
I suppose i have to handle the ColumnCreated event.
I can read the xml in order to create the columns(programmatically - using GridBoundColumn etc).
But i cannot handle an event that will let me read the values of my cells(via xpath or something)(according to the current column created by the control).
Can you provide some help please?
Thank you.

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 05 Nov 2010, 10:38 AM
Hello Tasos,

ColumnCreated is fired for autogenerated columns only - i.e. ones, which RadGrid has created automatically, according to the provided datasource.

If you have the column data in an XML, then you should create the columns in Page_Load or Page_Init. For more information about when and how - please read:

http://www.telerik.com/help/aspnet-ajax/grdprogrammaticcreation.html

As for your datasource, note that RadGrid currently does not support hierarchical XML as datasource. It has to be flat, like this:

<row cell1="value 1" cell2="value 2" .... />

Of course, if you construct a DataTable or something and then use it to bind the control, you can leave the XML as is.

Kind regards,
Dimo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
tasos
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or