How to use Repeater control

HI Guys !
Today .......

Use the Repeater control (sample)


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="repeatercontroldemo.aspx.cs"
    Inherits="repeatercontroldemo" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">
            <HeaderTemplate>
                <table width="100%">
                    <tr style="background-color: Fuchsia ">
                        <th>
                            id
                        </th>
                        <th>
                            name
                        </th>
                        <th>
                            location
                        </th>
                    </tr>
            </HeaderTemplate>
            <ItemTemplate>
                <tr style="background-color: Olive ">
                    <td>
                        <%#Eval("id") %>
                    </td>
                    <td>
                        <%#Eval("name") %>
                    </td>
                    <td>
                        <%#Eval("Location") %>
                    </td>
                </tr>
                          </ItemTemplate>
                          <%--<SeparatorTemplate>
                          <table>
                          <tr style ="background-color :Blue ">
                          <td><%#Eval("id") %></td>
                        
                          </tr>
                          </table>
                          </SeparatorTemplate>--%>
        
            <FooterTemplate>
            <div>
            <table width="100px"><tr style ="background-color : Red "><td><%#Eval("location") %></td></tr>
            <%#Eval ("Name") %>
            <asp:TextBox ID="txt" runat="server" BackColor ="Blue" ></asp:TextBox>
            <br />
            <asp:Label ID="lbl" runat="server" Text="this is the testing Label"></asp:Label>
            </table>
            </div>
               </table>
            </FooterTemplate>
        </asp:Repeater>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:kkConnectionString %>"
            SelectCommand="SELECT * FROM [emp]"></asp:SqlDataSource>
    </div>
    </form>
</body>
</html>


Then you'll get result  ............






Comments

Popular posts from this blog

Understanding ASP.NET MVC using real world example, for beginners and intermediate

iphone review

Unable to add google gmail in iphone