I am upgrading from ultrawebgrid to webdatagrid , and i need ti know what is the equivalent of UltraGridCell in WDG
UltraGridCell cell = new UltraGridCell(); cell.Value ="ABD";
row.Cells.Add(cell);
Hello Sreevani,
Thank you for posting in our community.
WebDataGrid control has a different architecture than its predecessor UltraWebGrid. It is a DataBound control, which means that it displays the records returned from the data source.
Basically, cells and rows could not be added directly to the WebDataGrid. Alternatively, you could add them straight to the data source and rebind the grid. Some further reference about WebDataGrid`s data binding, supported data sources etc. could be found at:
http://help.infragistics.com/doc/ASPNET/2014.1/CLR4.0/?page=WebDataGrid_Supported_Data_Sources.html
Please feel free to contact me if you have any additional questions regarding this matter.
Thanks , so i will work on the datasource directly and bind it to my grid .
How ever do you know if there is a substitute for the below Displaylayout and Bands in webdatagrid , how do i achieve this in codebehind?
string name= this.RoutesGrid.DisplayLayout.SelectedRows[0].Cells.FromKey("Name").ToString();
this.BatchStatusGrid.Bands[0].Columns[0].Header.Caption ="abc";
Thank you for getting back to me.
WebDataGrid does not have a DisplayLayout. What I can suggest for retrieving the text of a particular cell in the selected row is using Behaviors property of the grid. Via this property you could get a reference to the selection behavior an especially to the SeletedRows collection. Afterwards, using the items collection you could retrieve the value of any cell using its index. For example:
//gets the value for the cell in the first column(with index 0) of the selected row var selectedRowCell0Value = this.WebDataGrid1.Behaviors.Selection.SelectedRows[0].Items[0].Text;
//gets the value for the cell in the first column(with index 0) of the selected row
var selectedRowCell0Value = this.WebDataGrid1.Behaviors.Selection.SelectedRows[0].Items[0].Text;
What I can suggest regarding your second requirement is using the InitializeRow server side event to set the header text for a particular column. In this event via the event argument, which is current row being initialized, a reference to any column could be retrieved via the items collection. Again this is achieved with the column index. Afterwards, the column header text property could be set as following:
protected void WebDataGrid1_InitializeRow(object sender, RowEventArgs e) { //check row index and do this only on the first row, instead of doing it for every row if (e.Row.Index == 0) { e.Row.Items[0].Column.Header.Text = "Your header text here"; } }
protected void WebDataGrid1_InitializeRow(object sender, RowEventArgs e)
{
//check row index and do this only on the first row, instead of doing it for every row
if (e.Row.Index == 0)
e.Row.Items[0].Column.Header.Text = "Your header text here";
}
I hope you find this information helpful.
Please keep in mind that in order to ensure that we will provide you with better and more accurate support and ensure all your issues are addressed correctly I would recommend you having a single forum thread per single issue.
Please let me know if you need any further assistance with this matter.
1) need an way to implement TemplatedColumn in wdg.
proteed void Grid_InitializeRow(object sender, RowEventArgs e){if (e.Row != null){TemplatedColumn primary = (TemplatedColumn)e.Row.Items.FindItemByKey("name").Column; // what is an alternative for TemplatedColumnGridRecordItem cellItemPrimary = (GridRecordItem)primary.CellItems[e.Row.Index]; // is this correct?
2) how to implement CellItems in webdatagrid
GridField cellItemfirst = (GridField)first.CellItems[e.Row.Index];
3)find control on webdatagrid
Image secImage = (Image)cellItemSecondary.findcontrol("imgcol");
Hello Arjun,
Setting the column header in the Page_Load event is similar to setting it in the InitializeRow event. The only difference is that the reference to the Rows collection is taken via the WebDataGrid instead of the RowEventArguments. For example:
protected void Page_Load(object sender, EventArgs e) { this.WebDataGrid1.DataSource = populateGrid(); this.WebDataGrid1.DataBind(); WebDataGrid1.Rows[0].Items[0].Column.Header.Text = "Your header text here"; }
protected void Page_Load(object sender, EventArgs e)
this.WebDataGrid1.DataSource = populateGrid();
this.WebDataGrid1.DataBind();
WebDataGrid1.Rows[0].Items[0].Column.Header.Text = "Your header text here";
I hope this helps.
Please let me know if you have any additional questions regarding this matter.
Hello , Thanks but i dont want to set the header on InitializeRow event , may be just after databining to the grid on Page load , can you tell me how to do this ?
Hello,
Please do not hesitate to contact me if you need any further assistance with this matter.