After spending sometime trying to find help for the UltraWebGrid I discovered that it is really called WebGrid.....that should have been a sign.
I am shocked that I can find no sample or help on how to bind a generic List<> to the UltraWebGrid/WebGrid. I want to simply add DataBound codebehind entries in ASPX to define my columns and then bind a List<> to it at runtime, an extremely easy feat in other grids. I can find no help in help or samples on using ASPX markup to do this. The wixards won't let me do anything without giving them a design time source of some sort.
Is there a help file I'm missing? Does Infragistics only expect drag and drop users to use their grids?
mikeschellenberger said:It's amazing that it's that easy but I don't want all of the fields of the objects in my IEnumerable to be threw up in the grid.
You can then add columns to your grid manually, either via the designer or via the markup. To associate these columns with your data source, set the column's Key and BaseColumnName properties to both equal the name of the corresponding property on your data object (or to your DataColumn name, if you were using a DataSet, DataTable, or similar object). Be sure to leave the "IsBound" property set to false - otherwise, the grid will think that this column was automatically generated, and will remove it since you've set AutoGenerateColumns to false.
The same approach can be used to add columns to the grid through code, making sure that the same properties are set. This is most easily done in the InitializeLayout event of the grid. If you do this, the most important thing to note is to use the following approach to create your columns (in C#, assuming that this is in the grid's InitializeLayout event handler):
using Infragistics.WebUI.UltraWebGrid;...// This version of the constructor should be used to make certain// that the new column is tracked in ViewStateUltraGridColumn col = new UltraGridColumn(true);// Set these two properties to match the property in your data objectcol.Key = "SomeKey";col.BaseColumnName = "SomeKey";// Add the column to the gride.Layout.Bands[0].Columns.Add(col);
This is my first encounter with Infragistics controls in a number of years. I would assume no further response to mean that Infragistics supplies nothing other than trivial documentation, help and samples. This also leads me to beleive that Infrgistics is primarily targeting their controls to drag and drop developers.
It's amazing that it's that easy but I don't want all of the fields of the objects in my IEnumerable to be threw up in the grid. I want to set the bound fields in markup just like I do for other grids...i.e. MS grid uses this syntax
<Columns> <asp:BoundField ReadOnly="True" HeaderText="ID" InsertVisible="False" DataField="ProductID" SortExpression="ProductID"> <ItemStyle HorizontalAlign="Center"></ItemStyle> </asp:BoundField>
The Infrangistics UltraWebGrid has no concept of a BoundField that I can see from the help file or samples. How are we supposed to only display what we want out of a datasource? Where can I find help/documentation/samples on using the markup?
You can set the data source of the WebGrid via code to any IEnumerable (Collection).
IList myList = GetListDataSource();this._grid.DataSource = myList;this._grid.DataBind();
Here are a couple of samples - Note: Some of these uses datasets/data tables (You can bind your list the same way these bind to the ADO.NET classes).