Hi,
I was able to create a hierarchy webgrid (using ObservableCollection) and would like to create the column layout dynamically.
here is my code:
e.ColumnLayout.Columns.Add(
new TextColumn(){
HeaderText =
"TestId",
Key = "Id",
Width =
new ColumnWidth(20, false));
But it gave me this error:
The following key(s) do not correspond with the DataSource: "Id". If you'd like to add additional columns, please use the TemplateColumn type.
Using the ColumnLayoutAssigned event, how do I get the key of each column for each band - parent and child?Thanks for your help
So what exactly are you trying to do?
The ColumnLayoutAssigned event is mainly for overriding the ColumnLayout that is going to be used, generally this would be if you have AutoGenerateColumns on.
If you're just trying to define ColumnLayouts for different levels, then you can use the ColumnLayouts property on the XamWebGrid, which allows you define ColumnLayouts globally.
Check out the following article which describes in detail the various ways to define a ColumnLayout:
http://help.infragistics.com/Help/NetAdvantage/Silverlight/2009.1/CLR3.5/html/SL_xamWebGrid_Define_Column_Layout.html
-SteveZ
Hi Steve,
I try to build the grid column at run time. So, in what event should use then to do this if it is not in the ColumnLayoutAssigned? Thanks!
You don't have to do it in any event. You can do it when you create your grid.