Hello,
I am following the video sample "WebDataGrid Master Detail' to add a template column but I cant get it to work..
I get the following error when implementing a template column: BC30691: 'TemplateContainer' is a type in 'UI' and cannot be used as an expression.
I am using VS 2008 with infragistics 2010, in VB.net and a SQL datasource
Any ideas what could be wrong?
Thanks
Dan
<%# DataBinder.Eval(((Infragistics.Web.UI.TemplateContainer)Container).DataItem, "CustomerName") %>
Hi Tsvetelina,
I have a column like this one, using a TemplateContainer. I am using a WebDataGrid in 13.1. How do I retrieve the text of the link in c# on the server side?
Thank you,
Gregory
Hello in VB.Net the syntax is :
Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4
<ig:TemplateDataField Key="UnitPrice">
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server"
Text='<%# DataBinder.Eval(DirectCast(Container, Infragistics.Web.UI.TemplateContainer).DataItem, "UnitPrice") %>'
CommandArgument='<%# DataBinder.Eval(DirectCast(Container, Infragistics.Web.UI.TemplateContainer).Item, "Row.Index") %>'>
</asp:LinkButton>
</ItemTemplate>
<Header Text="UnitPrice" />
</ig:TemplateDataField>
It seems to generate c# syntax to cast the Infragistics template container to a standard container.
Try this instead:
DataBinder.Eval(DirectCast(Container, Infragistics.Web.UI.TemplateContainer).DataItem, "CustomerName")
I had the same issue.
I start a new ASP project (VB), add a grid and connect it to a data source, then convert a grid field to a template field. The ASP code generated is in error:
<%# DataBinder.Eval(((Infragistics.Web.UI.TemplateContainer)Container).DataItem, "Name_Last") %>
However, if I do the exact same thing EXCEPT start from a new web site, not a new ASP project then the generated ASP works:
<%# DataBinder.Eval(CType(Container, Infragistics.Web.UI.TemplateContainer).DataItem, "Name_Last") %>
The problem was resolved when I created a new website instead of a new web project
Not sure why that is