Hi LyLy,
Thanks for the update.
Using ItemTemplates we can have other controls dynamically inside Grid. Please refer the below code snippet which illustrtaes this:
public class TemplateClass : ITemplate
{
private Control m_ctrlChildControl = null;
public TemplateClass(Control ctrlChildControl)
{
m_ctrlChildControl = ctrlChildControl;
}
public void InstantiateIn(Control container)
{
container.Controls.Add(m_ctrlChildControl);
}
}
void GridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellType.AlternateRecordFieldCell || e.TableCellIdentity.TableCellType == Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellType.RecordFieldCell)
{
if (e.TableCellIdentity.Column.Name == "City")
{
if (e.Style.CellValue == "")
{
System.Web.UI.WebControls.ImageButton img = new System.Web.UI.WebControls.ImageButton();
img.ID = "Image1";
img.ImageUrl = "add.png";
TemplateClass mytemp = new TemplateClass(img);
e.TableCellIdentity.Column.ItemTemplate = mytemp;
}
}
}
}
As per your sample you are inserting an Empty row, and adding ImageButton on the last column, the above code checks for the last column empty cell to have a template.
Pleae refer the sample from the below link, which illustrates this:
http://www.syncfusion.com/support/user/uploads/Sample_13116dcc.zipPlease have a look at the above, and let us know if this helps you out.
Regards,
Raji