Click here to Skip to main content
15,890,897 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How Are You Guys ,,

I'm making a website provides artricles and news for the users ,
i have the articles in database and i put it in datalist in StatPage.aspx , then i have made the items in the datalist HyperLinks so The user can click on it and redirect to View.aspx to View it ,
My Problem is:

1-How to get The data From the Database in DataList when i click the Hyperlink and redirect to View.aspx and Put the data in Text Box Or lable or any Thing ??

Here Is My Code :

ASP.NET
<asp:DataList ID="DataList1" runat="server" BackColor="#FF0066" BorderColor="Black"
            CellPadding="4" DataSourceID="SqlDataSource1" ForeColor="#333333" Width="647px">
            <AlternatingItemStyle BackColor="White" />
            <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
            <ItemStyle BackColor="#FFFBD6" ForeColor="#333333" />
            <ItemTemplate>
                AticleTitle: 
                <asp:HyperLink ID="Title" runat="server" NavigateUrl="#"<asp:Label ID="AticleTitleLabel" runat="server" Text='<%# Eval("AticleTitle") %>' /></asp:HyperLink>
                <br />
                ArticleBody:
                <asp:Label ID="ArticleBodyLabel" runat="server" Text='<%# Eval("ArticleBody") %>' />
                <br />
                <br />
            </ItemTemplate>
            <SelectedItemStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
        </asp:DataList>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:BrainStormsConnectionString %>"
            SelectCommand="SELECT [AticleTitle], [ArticleBody] FROM [Articles]"></asp:SqlDataSource>
    </div>


Any Solution Please ..

regards..
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900