Thursday, 18 October 2012

datalist with sql data source in asp.net c#



--------------------------------------------------------------------------------------
<asp:DataList
        ID="DataList1" runat="server" BackColor="LightGoldenrodYellow" BorderColor="Tan"
        BorderWidth="1px" CellPadding="2" DataSourceID="SqlDataSource1" Width="361px" ForeColor="Black">
        <FooterStyle BackColor="Tan" />
        <SelectedItemStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
        <ItemTemplate>
            <br />
            <table style="border-left-color: #660000; border-bottom-color: #660000; width: 425px;
                border-top-style: solid; border-top-color: #660000; border-right-style: solid;
                border-left-style: solid; border-right-color: #660000; border-bottom-style: solid">
                <tr>
                    <td align="left" style="width: 7px; height: 36px">
                        <span><span style="text-decoration: underline">
                        <span style="color: #ffffff; font-size:12pt;background-color: #990066;">OFFERS:</span>
                        </span>
                        </span>
                    </td>
                    <td align="left" style="width: 100px; height: 36px; text-align: left;">
 <asp:Label ID="OFFERSLabel" runat="server" Text='<%# Eval("OFFERS") %>' Width="320px" Font-Size="12pt" BackColor="LightGoldenrodYellow" ForeColor="#990066"></asp:Label></td>
                </tr>
                <tr>
                    <td colspan="2" style="height: 19px"> </td>
                     
                </tr>
                <tr>
                    <td style="width: 7px; height: 27px; text-align: left;">
                        <span style="color: #ffffff;  font-size:12pt; background-color: #990066;">DETAILS:</span></td>
                    <td style="width: 100px; height: 27px; text-align: left;" valign="top">
 <asp:Label ID="DETAILSLabel" runat="server" Text='<%# Eval("DETAILS") %>' Width="320px" Font-Size="12pt" BackColor="LightGoldenrodYellow" ForeColor="#990066"></asp:Label></td>
                </tr>
            </table>
            <br />
        </ItemTemplate>
        <HeaderStyle BackColor="Tan" Font-Bold="True" />
        <AlternatingItemStyle BackColor="PaleGoldenrod" />
    </asp:DataList>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:CreationsLaptopConnectionString %>"
        SelectCommand="SELECT Offer_Name as OFFERS , Offer_Detail as DETAILS  FROM Offer">
</asp:SqlDataSource>

--------------------------------------------------------------------------------------------

No comments:

Post a Comment