如何在Gridview中将Label值显示到另一个页面? [英] How to display the Label value inside the Gridview to another page ?
本文介绍了如何在Gridview中将Label值显示到另一个页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的deafult.aspx页面中有这样的网格视图:
< asp:TemplateField HeaderText = 价格 >
< ItemTemplate >
< asp:标签 ID = lblPrice runat = 服务器 文字 =' <% #Eval( price)%> ' < span class =code-attribute> / >
< / ItemTemplate >
< / asp:TemplateField >
< asp:TemplateField HeaderText = 项目总数 >
< ItemTemplate >
< asp:标签 ID = lblItemTotal runat = server 文本 =' < % #Eval( Item_total) %> ' / >
< / ItemTemplate >
< / asp :TemplateField >
当用户点击确认按钮时,我希望此网格视图以gridview形式显示在另一个页面中。
请给我看一个例子,这样我就能轻松理解。请:)
解决方案
您的要求有两种方式。
首次点击确认按钮时会话中数据集或数据表中gridview的内容,并在下一页gridview中绑定会话值。
第二种方式
使用
Server.Transfer(〜/ Page2.aspx);
请参阅此链接以获取第二种方式 [ ^ ]
投票如果这解决了你的问题
I had a gridview like this in my deafult.aspx page:
<asp:TemplateField HeaderText="Price">
<ItemTemplate>
<asp:Label ID="lblPrice" runat="server" Text='<%#Eval("price")%>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Item Total">
<ItemTemplate>
<asp:Label ID="lblItemTotal" runat="server" Text='<%#Eval("Item_total") %>' />
</ItemTemplate>
</asp:TemplateField>
When user click the confirm button, i want this gridview to be displayed in another page in gridview form.
Please show me an example so I can understand easily. Please :)
解决方案
There are two ways for your requirement.
First when confirm button is clicked store the contents of your gridview in a dataset or datatable in session and bind the session value in next page gridview.
Second way
By using
Server.Transfer("~/Page2.aspx");
Refer this link for second way[^]
Vote up if this solved your problem
这篇关于如何在Gridview中将Label值显示到另一个页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文