本文介绍了需要将数据库数据从数据列表从页面转移到另一页面中的文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 你是怎么回事, 我正在为一个网站提供艺术品和新闻给用户, i有文章在数据库中,我把它放在StatPage.aspx的datalist中,然后我在datalist HyperLinks中制作了这些项目,用户可以点击它并重定向到View.aspx查看它, 我的问题是: 1 - 如何从DataList中的数据库中获取数据当我单击超链接并重定向到View.aspx并将数据放入文本框或标签时或者任何事情? 这是我的代码: < asp:DataList ID = DataList1 runat = ser ver BackColor = #FF0066 BorderColor = 黑色 CellPadding = 4 DataSourceID = SqlDataSource1 ForeColor = #333333 宽度 = 647px > < AlternatingItemStyle BackColor = 白色 / > < FooterStyle BackColor = #990000 字体粗体 = True ForeColor = 白色 / > < HeaderStyle BackColor = #990000 Font-Bold = True ForeColor = White / > < ItemStyle BackColor = #FFFBD6 ForeColor = #333333 / > < ItemTemplate > AticleTitle: < asp:HyperLink ID = 标题 runat = 服务器 NavigateUrl = # < asp:Label ID = AticleTitleLabel runat = 服务器 文字 =' <% #Eval( AticleTitle)%>' / > < / asp:HyperLink > < br / > ArticleBody: < asp :标签 ID = ArticleBodyLabel runat = server 文本 =' <% #Eval( ArticleBody )%>' / > < br / > < br / > < / ItemTemplate > < SelectedItemStyle BackColor = #FFCC66 字体粗体 = 真 ForeColor = 海军 / > < / asp:DataList > < asp:SqlDataSource ID = SqlDataSource1 runat = server ConnectionString = <% $ ConnectionStrings:BrainStormsConnectionString%> SelectCommand = SELECT [AticleTitle], [ArticleBody] FROM [文章] > < / asp:SqlDataSource > < / div > 任何解决方案请.. 问候.. 解决方案 ConnectionStrings:BrainStormsConnectionString%> SelectCommand = SELECT [AticleTitle],[ArticleBody] FROM [Articles] > < / asp:SqlDataSource > < / div > 任何解决方案请.. 问候。 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: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.. 解决方案 ConnectionStrings:BrainStormsConnectionString %>" SelectCommand="SELECT [AticleTitle], [ArticleBody] FROM [Articles]"></asp:SqlDataSource> </div>Any Solution Please ..regards.. 这篇关于需要将数据库数据从数据列表从页面转移到另一页面中的文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 11-03 13:44