23 April 2014

How to bind multiple data to itemtemplate label in gridview



<asp:GridView ID="gv1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource2">
    <Columns>
        <asp:TemplateField >
             <ItemTemplate>
              <asp:Label ID="Label1" runat="server" Text='<%# String.Format("{0} {1} {2} {3} {4}" ,"(", Eval("Id") , "-" ,Eval("Name"), ")") %>'></asp:Label>
              </ItemTemplate>
       </asp:TemplateField>
   </Columns>
</asp:GridView>

No comments:

Post a Comment