Please help me with this error!!!!!!

  • Thread starter Thread starter William Gower
  • Start date Start date
W

William Gower

expression expected!!!!

<asp:TemplateColumn runat="server" HeaderText="Customer" >
<ItemTemplate>
<asp:label runat="server" Text='<#
DataBinder.Eval(Container.DataItem,
"PrimaryName") +
" - " +
DataBinder.Eval(Container.DataItem,
"Branch") %>' />
</ItemTemplate>
</asp:Template>
 
Try this idea instead

<asp:label runat="server" Text='<%#
DataBinder.Eval(Container.DataItem,"PrimaryName") %> - <%#
DataBinder.Eval(Container.DataItem, "Branch") %>' />

I think that the problem you are running into is, it's evaluating the data
binding routines and dumping the text, but then you are attempting to
concatenate with another string, which doesn't really work with how the
DataBinder is just attempting to dump text.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
 
Try this. (Note that you don't need the label tag if you are just displaying
data from the datagrid)

<td width="100">
<%# DataBinder.Eval(Container.DataItem, "PrimaryName")
&nbsp
<%# DataBinder.Eval(Container.DataItem, "Branch") %>
</td>
 
Just to clarify if would look like this
<asp:TemplateColumn runat="server" HeaderText="Customer" >
<ItemTemplate>
<td width="100">
<%# DataBinder.Eval(Container.DataItem, "PrimaryName")
&nbsp
<%# DataBinder.Eval(Container.DataItem, "Branch") %>
</td>
..
..
..
etc.
 
<asp:label runat="server" ><%#DataBinder.Eval(Container.DataItem,"PrimaryName") %> -
<%#DataBinder.Eval(Container.DataItem, "Branch") %><asp:label /

Tell me if it doesn't work ([email protected]
 
Back
Top