I am using UltrawebGrid and binding with a datasource in codebehind. I want to bind the ultrawebgrid columns based on the datasource values and also want to change the colour of that cell. Please advice how to proceed.
Hi MPF_COGNIZANT,
Thank you for posting in the community.
In order to define the datasource field used for a column in UltraWebGrid, you may set the BaseColumnName property. For instance:
UltraWebGrid1.Columns[0].BaseColumnName = "ID"; UltraWebGrid1.DisplayLayout.AutoGenerateColumns = false; UltraWebGrid1.DataSource = populateGrid(); UltraWebGrid1.DataBind();
The base column name can be dynamically/conditionally changed in order to implement your requirement. Styling individual cells may be done in the InitializeRow handler by accessing the style of the particular cell:
e.Row.Cells[0].Style.ForeColor = System.Drawing.Color.Green;
Please note that the UltraWebGrid control is now outdated and as of .NetAdvantage 2011 Volume 2 is no longer included in our product package. I would suggest that you consider switching to the WebDataGrid/WebHieararchicalDataGrid. More information regarding these controls is available at:
http://help.infragistics.com/NetAdvantage/ASPNET/2011.2/CLR4.0/?page=Web_WebDataGrid_WebDataGrid.html
Additional samples demonstrating the features of these grids can be found at:http://samples.infragistics.com/aspnet/
Hope this helps.
Thank you for your response.
I would like assign Ultragrid column data based on dataset values. Not directly assigning datset to ultragrid. i did that based on below script.
dtgtable.DisplayLayout.Rows(iCounter).Cells(0).Value .
But in this first i need to initialise grid with a dataset. Otherwise it is throwing object reference exception.
My second question is that i would like change the color of the control in the grid cell ( checkbox) dynamically based on the dataset values.Please advice the same.
We are using ultragrid in much number of places in our application. Is there any easy methodology to upgrade it to webdatagrid or do we need to completely re-write the code? Please send with any examples.
Thank you for your reply.
Given that your grid is being bound to a datatable with the desired number of rows, you can dynamically set the cell values using the InitializeRow event as outlined above:
e.Row.Cells[0].Value = "some value";
Individually styling templated controls may be achieved at runtime by accessing the templated control for the respective row as described at:
http://forums.infragistics.com/forums/t/26392.aspx
Regarding the migration process, as the the new AIKIDO controls have a different architecture than that of the classic ones, the overall structure and API is changed. Therefore the migration process entails manually moving the implemented configuration of the old controls to the new ones. In terms of the functionality provided by the new toolset, we have made every attempt to ensure that all commonly used features of the classic suite are available as well. On that note, a detailed supposition between the features provided by our grids in particular may be found in the "Product Changes" blog:
http://community.infragistics.com/blogs/taz_abdeali/archive/2011/11/17/asp-net-product-changes-in-2011-volume-2.aspx
Rest assured you can expect our full support and assistance during the migration process should you decide to undertake it.
Please do not hesitate to contact me if you have any questions on that topic.
Am thakful you for your quick reply.
Regarding changing color of the control in the grid am creating dynamic columns. And not using any template . Check the same below.
dtgCOAEmailLog.Columns(0).Type =
ColumnType.CheckBox
dtgCOAEmailLog.Columns(0).AllowUpdate =
AllowUpdate.No
dtgCOAEmailLog.Columns(0).Width = Unit.Pixel(70) dtgCOAEmailLog.Columns(0).HeaderText = "text1"
dtgCOAEmailLog.Columns(0).Width =
Unit.Pixel(70)
dtgCOAEmailLog.Columns(0).HeaderText = "text1"
dtgCOAEmailLog.Columns(0).HeaderText =
"text1"
Please let me know how to proceed in this case.