I've been using the UltraWebGrid and populating it through code for over 6 years. Is there any
documentation on how to map the UltraWebGrid features to the WebDataGrid???
When attempting to populate a WebHierarchalDataGrid I keep getting the "Index Out of Range" error. Why is this happening??? In preparation for using the new Grids all I'm trying to do for a test is the following (In VB Code Behind):
- Create an unbound field
- Add that field to the grid
- Change the value of that field
Can someone give me a code snippet to do that? After 6+ years of doing this with the UltraWebGrid my mind is not grasping the mechanics of the new grids
I have just spent 2 hours of my Saturday trying to apply what I've read and nothing works. My first question is how do you call the InitializeRow event of the WebDataGrid???
Alex,
Thanks for your response. The examples you provided are excellent and have pointed me in the right direction. Its going to take me some time to learn the new mechanics of the WebDataGrid
Hello legalke,
There are significant differences in the framework and design of the new “WebDataGrid” compared to the classic “UltraWebGrid”. Many of the behaviors and properties are changed or replaced with new ones. Without knowing the logic of your application it will be very difficult to simply “translate” the code for the classic grid into code for the new grid.
What I can do is to point you to the right direction on what methods and behaviors you should use or change to achieve similar functionality as shown in your code.
Dim wdgCell As Infragistics.Web.UI.GridControls.GridRecordItem ' grid cell
' only for WebHierarchicalDataGrid
Dim band As Infragistics.Web.UI.GridControls.Band ' grid band
Me.WebHierarchicalDataGrid1.GroupingSettings
.EnableColumnGrouping = DefaultableBoolean.True ' enable grouping
.GroupAreaVisibility = Visibility.Visible ' set grouping visibility
.GroupByAreaLocation = GroupByAreaLocation.Top ' set grouping location
...
More about grouping you can find here - http://help.infragistics.com/Help/NetAdvantage/ASPNET/2010.3/CLR4.0/html/WebHierarchicalDataGrid_Group_Columns_from_Code_Behind.html
More about enabling the other grid behaviors you can read here - http://help.infragistics.com/Help/NetAdvantage/ASPNET/2010.3/CLR4.0/html/WebDataGrid_Adding_a_Behavior_at_Runtime.html
…
Me.WebHierarchicalDataGrid1.Bands(0).Columns("col name").Width = Unit.Pixel(100) ' set column size
Me.WebHierarchicalDataGrid1.Bands(0).Columns("col name").Header.Text = "your text" ' set column header text
Dim boundCol As New Infragistics.Web.UI.GridControls.BoundDataField ' new bound field
boundCol.Header.Text = "Text" ' header text
boundCol.Header.CssClass = "yourCssclass" 'header style
Me.WebHierarchicalDataGrid1.Bands(0).Columns.Add(boundCol) ' add column
Dim whdgRow As Infragistics.Web.UI.GridControls.GridRecord = New Infragistics.Web.UI.GridControls.GridRecord() ' row object
Some of the objects shown will not work as they were in “UltraWebGrid”. That is why a simple conversion will be hard to make and you will have to change some of the logic in your grid.
I can recommend you to go through samples available for “WebHierarchicalDataGrid” and read about the new features available with this control in order to decide how to achieve the required functionality with the new grid:
http://samples.infragistics.com/aspnet/ComponentOverview.aspx?cn=hierarchical-data-grid
http://help.infragistics.com/Help/NetAdvantage/ASPNET/2010.3/CLR4.0/html/Web_WebHierarchicalDataGrid.html
Let me know if you need further assistance with this question.
I started to review the documentation that's been provided for converting a UltraWebGrid to a WebDataGrid. Unfortunately another project at work has stopped me from testing it. A quick conversion of my code above would give me a jumpstart. Thanks