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 TemplatedColumn GridRecordItem 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,
Official documentation regarding Adding/Removing Columns, including Templated Columns to WebDataGrid could be found here:
Please notice,
When Templated columns in WebDataGrid are created programmatically in the code behind, the item template needs to be re-instantiated on each postback. More information on creating templates programmatically can be found at:
http://help.infragistics.com/Doc/ASPNET/2014.1/CLR4.0/?page=WebDataGrid_Using_Item_Template.html
You could find an online sample, regarding the use of column templates
http://ko.infragistics.com/samples/aspnet/data-grid/using-cell-and-column-templates
Reference a Cell When Creating an Item Template-official documentation
Find control in a templated column: In order to access Templated control in a WebDataGrid templated column from code behind, I suggest create a new instance of this control end iterate via the grid rows using FindControl(“”controlID”). This topic has being discussed here:
http://ko.infragistics.com/community/forums/t/45205.aspx
In general, you can only get a templated control from the corresponding cell, and not from the row. You could use column index, OR you can use its key, for example:
WebDropDown WebDropDown1= (WebDropDown1)WebDataGrid1.Rows[0].Items.FindItemByKey("ColumnKey").FindControl("WebDropDown1");
A similar topic is discussed here: http://ko.infragistics.com/community/forums/t/75727.aspx
on the deisgn i have the following code
<igtbl:Templatecolumn DataFieldName="SecondaryFileAvailable" Key="SecondaryFileAvailable"> <Header Text="Sec" /> <CellStyle HorizontalAlign="Center" /> <CellTemplate> <asp:Image ID="imgCol2" runat="server" /> </CellTemplate> </igtbl:Templatecolumn >
how do i transform this code into webdatagrid ?