Item Template problem in Datagrid

S

stephen

Hi all,

I have a itemtemplate in a DataGrid and it works fine on VB .NET but the
same does not work in C#

<asp:Templatecolumn HeaderText="EVID" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "EVID").ToString() %>
<asp:HyperLink runat="server" id="myLink" text="View..." NavigateUrl='<%#
"default.aspx?id=" & Container.DataItem("EVID") %>' /> <---happens here
</ItemTemplate>
</asp:Templatecolumn>

what am i missing?

I get this error: (IN C#)
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.

Compiler Error Message: CS0019: Operator '&' cannot be applied to operands
of type 'string' and 'object'


Thanks,
Stephen
 
M

Mohsin Rizvi

<asp:HyperLink runat="server" id="myLink" text="View..." NavigateUrl='<%#
"default.aspx?id=" & Container.DataItem("EVID") %>' />

Hello Stephen!

try this,

<asp:HyperLink runat="server" id="myLink" text="View..."
NavigateUrl='<%#
"default.aspx?id=" + Container.DataItem("EVID").ToString() %>' />

and kindly let me know in any case.

Regards,
Mohsin Rizvi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top