Monday 30 December 2013

ASP.NET 2013 - How to bind multiple data to itemtemplate label in gridview

Watch this example on YouTube




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

No comments:

Post a Comment