且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Gridview中将Label值显示到另一个页面?

更新时间:2022-12-09 16:11:34

您的要求有两种方式。

首次点击确认按钮时会话中数据集或数据表中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