Hi,
I want to iterate the WebDataGrid.Rows collection and convert it into DataTable. I am using Infragistics V11.1 version.
example:
foreach(GridRecrod recrod in WebDataGrid1.Rows)
{
DataRowView row=(DataRowView)record;
DataRow r=row.Row;
}
I want to type cast GridRecord to DataRow which I am not able to do.
So kindly help keeping in mind that I am using v11.1 and want to convert GridRecordCollection to DataTable.
Please help me with this
Thanks,
Manoj
Hello Man,
Thank you for posting in the community.
Since DataRow and GridRecord are significantly different objects with very differing properties what I can suggest for achieving your requirement is creating a new DataRow object and populating it with the values from the GridRecord object. For example:
protected void Button1_Click(object sender, EventArgs e) { DataTable tableFromGridRows = new DataTable(); tableFromGridRows.Columns.Add("ID"); tableFromGridRows.Columns.Add("Name"); DataRow dr; foreach(GridRecord gr in WebDataGrid1.Rows) { dr = tableFromGridRows.NewRow(); dr["ID"] = gr.Items[0].Text; dr["Name"] = gr.Items[1].Text; tableFromGridRows.Rows.Add(dr); } }
protected void Button1_Click(object sender, EventArgs e)
DataTable tableFromGridRows = new DataTable();
tableFromGridRows.Columns.Add("ID");
tableFromGridRows.Columns.Add("Name");
DataRow dr;
foreach(GridRecord gr in WebDataGrid1.Rows)
dr = tableFromGridRows.NewRow();
dr["ID"] = gr.Items[0].Text;
dr["Name"] = gr.Items[1].Text;
tableFromGridRows.Rows.Add(dr);
I made a small sample project illustrating my suggestion and I am attaching it for your reference.
In my sample on a button click I am looping trough the grid rows, I am taking cell values and I am assigning these values to a new row of type DataRow. In the end the result is a table populated with the same rows as the WebDataGrid.
I hope you find this information helpful.
Please let me know if you need any further assistance with this matter.
Regards,
Vasya Kacheshmarova
Developer Support Engineer
Infragistics
Previously in our project we are using UltrawebGrid and we use to apply our own formatting style for grid pointing to custom formatting folder. Now I have implemented WebDataGrid V11.1. Now I want to apply the same formatting style to the new grid. So in web.config how should specify the existing formatting folder(contain .css,images etc) as a path to the new Webdatagrid.
Hello Manoj,
The WebDataGrid (and other AIKIDO Framework controls) use a different styling structure than the old controls, hence the CSS styling classes and images used are different. More information on styling your application may be found in our documentation at:
http://help.infragistics.com/doc/ASPNET/2014.1/CLR4.0/?page=Web_Application_Styling_Framework_ASF.html
For styling WebDataGrid in particular, you may find additional useful information in the following guide describing individual roles of CSS classes in the grid styleset:
http://es.infragistics.com/community/blogs/engineering/archive/2010/08/25/webdatagrid-css-styling-guide.aspx
Please feel free to contact me if you have any questions.
Please do not hesitate to contact me if you have any further questions regarding this matter.
I am moving from Infra v7 to v11.1. In previous application we are using UltraWebListBar, WebPanel etc, now I want to replace Listbar with ExplorerBar. Here is code for that:-
<iglbar:UltraWebListbar ID="historymenu" runat="server" BarWidth="100%" BorderStyle="none" BorderWidth="1px" MergeStyles="True" OnItemClicked="leftMenu_ItemClicked" Width="141px" Height="100%" KeepInView="No"> <DefaultItemHoverStyle BorderStyle="Outset" BorderWidth="1px" CssClass="SterlingMenuItemHover"> <Margin Left="0px" /> </DefaultItemHoverStyle> <DefaultGroupButtonHoverStyle CssClass="MenuGroupHover"> </DefaultGroupButtonHoverStyle> <DefaultItemStyle Cursor="Hand" CssClass="SterlingMenuItem"> <Margin Left="1px" /> <Padding Left="5px" /> </DefaultItemStyle> <DefaultGroupButtonStyle Cursor="Hand" Height="24px" CssClass="MenuGroup"> <Padding Left="3px" /> </DefaultGroupButtonStyle> <DefaultGroupStyle BackColor="WhiteSmoke" Cursor="Hand" Height="100%"> </DefaultGroupStyle> <DefaultGroupButtonSelectedStyle Cursor="Hand" ForeColor="Black" CssClass="MenuGroupSelect"> </DefaultGroupButtonSelectedStyle> <DefaultItemSelectedStyle BorderStyle="Inset" BorderWidth="1px" Cursor="Hand" CssClass="SterlingMenuItem"> <Margin Left="0px" /> </DefaultItemSelectedStyle> <AutoPostBack GroupClicked="False" GroupCollapsed="False" GroupExpanded="False" /></iglbar:UltraWebListbar>
Can you please help me out the replace code in WebExplorerBar, specially for css formatting and other stuff done in code for UltraWebListBar.
Also provide code behind how to add item in group and iterate through group list etc.
Thanks in advance !!!!!!!!!!!