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

[Solved] match header unique name with list<> content

1 Answer 65 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jonas Hero
Top achievements
Rank 1
Jonas Hero asked on 12 Aug 2009, 11:51 AM
hey,

im building a grid with the following header col definitions:

GridViewDataColumn actColumn = new GridViewDataColumn();
actColumn.UniqueName = "MYNAME";
myGrid.Columns.Add(actColumn);

the item source is a list<> with a self defined object:

    public class DataTest
    {
        private string myname;

        public string MYNAME
        {
            get { return this.myname; }
        }             
   }

the grid binds the uniqe name, defined in the datacolumn automatically to the get member in the object collection an displays it in the right column.

but i'dont want to write an new object for every application case. can i add some kind of data structure to the list<> (eg an iEnumerable with XElements) ? the data structure in the xml should be like this:

<MYNAME>stringToDisplay</MYNAME>
<MYNAME>stringToDisplay</MYNAME>
...

is it possible to do the automatic matching between the header cols and the databind with such or a similar mechanism?

thanks in advance,

jonas

1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 12 Aug 2009, 12:55 PM
Hi Jonas,

You can use auto-generated columns instead and modify the grid columns on the fly using AutoGeneratingColumn.

Best wishes,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
Jonas Hero
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or