如何在另一页的详细信息中打开datalist中的数据 [英] How to open data from datalist in a details on another page

查看:89
本文介绍了如何在另一页的详细信息中打开datalist中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

页面store.aspx包含datalist视图

页面详情.aspx包含详细信息视图



数据列表显示项目的图像和模型

如果用户点击图片或模型我想在页面详细信息的详细信息视图中显示其详细信息.aspx

page store.aspx contains datalist view
page details.aspx contain details view

data list shows image and model of an item
if user clicks image or model I want its details to be displayed in details view on page details.aspx

推荐答案

检查此 click-image-in-datalist并在详细信息页面中获取相同内容 [ ^ ]


您只需要通过查询字符串传递值。只要正确编写SQl,下一页就会使用它并显示所需内容。
You just need to pass the value through the querystring. The next page will use it and display what is needed as long as you write the SQl correctly.


As RyanDev 建议最好的方法是使用QueryString传递商店和详细信息页面之间的值。



在DataList控件中的Image ItemTemplateField周围使用锚标记,并在Href属性中设置QueryString(甚至可以使用带NavigateUrl的HyperLink)。



类似



As RyanDev suggested the best way is to use QueryString to pass the value between the Store and Details page.

Use a Anchor Tag around the Image ItemTemplateField in the DataList Control and set the QueryString in Href Property (or even HyperLink with NavigateUrl can be used too.)

Something like

<ItemTemplate>
<a href="~/Details.aspx?productid=<%#Eval("ProductID")">
<asp:Image ID="image" runat="server" ImageUrl="someimage.jpg"> </a>
</ItemTemplate>







详细页面获取QueryString,如






And in Detail Page Fetch the QueryString like

Request.QueryString["productid"]


这篇关于如何在另一页的详细信息中打开datalist中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆