So in a gridview you want to combine 2 fields together in presenting the output, or you want to make it appears as
<columns>
<asp:templatefield headertext="No">
<itemtemplate>
<%=countr++%> <%# Eval("Title") %>
</itemtemplate>
</asp:templatefield></columns>
Ensure its <%# and not <%=
Another nicer way to do it:-
<asp:TemplateField HeaderText="Title">
<ItemTemplate>
<%# String.Format("<a href='viewTaskDetail.aspx?id={0}'>{1}</a>",Eval("ID"),Eval("Title")) %>
</ItemTemplate>
</asp:TemplateField>

<columns>
<asp:templatefield headertext="No">
<itemtemplate>
<%=countr++%> <%# Eval("Title") %>
</itemtemplate>
</asp:templatefield></columns>
Ensure its <%# and not <%=
Another nicer way to do it:-
<asp:TemplateField HeaderText="Title">
<ItemTemplate>
<%# String.Format("<a href='viewTaskDetail.aspx?id={0}'>{1}</a>",Eval("ID"),Eval("Title")) %>
</ItemTemplate>
</asp:TemplateField>
No comments:
Post a Comment