Hello.
My goal is to add to WebDataGrid a field containing a LinkButton with a server-side event. I'm adding the new column in codebehind on PageLoad event along with creating and binding DataSet. After clicking the link the page recieves PostBack, this time I bind stored DataSet to the grid but the TemplateDataField column remains empty.
I've attached an example application illustrating this behaviour. It looks like the instance of ItemTemplate does not trigger OnDataBinding event of the container on the secondary DataBinding.
Hello Anton,
Thank you for posting in our forum.
The template needs to be set on each postback.Otherwise it will not be re-created on postback.
Make sure that you get the related column and set the ItemTemplate on postback. For example:
if (!IsPostBack)
{
…
}
else
var ds = (DataSet) Session["ds"];
if (ds != null)
WebDataGrid1.ClearDataSource();
TemplateDataField temp = (TemplateDataField)WebDataGrid1.Columns["Attachments"];
temp.ItemTemplate = new AttachmentsTemplate();
WebDataGrid1.DataSource = ds;
WebDataGrid1.DataBind();
Let me know if you have any question.
Best Regards,
Maya Kirova
Developer Support Engineer II
Infragistics, Inc.
http://www.infragistics.com/support