如何使用第二页上的标签将Gridview列值显示到另一页面。 [英] How to display Gridview column value to another page using label on second page.

查看:66
本文介绍了如何使用第二页上的标签将Gridview列值显示到另一页面。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用第二页上的标签将Gridview列值显示到另一个页面。

======================== =====================



我有两页

< br $>
page1.aspx和page2.aspx



在page1.aspx中我有Gridview,当我使用select命令按钮单击特定行时。我想在第二页显示一个列值。



在第二页中,我有标签显示所选行列值。



你可以帮忙。



如何使用标签将列值传递到另一个页面。



谢谢....

How to display Gridview column value to another page using label on second page.
=============================================

I have two pages

page1.aspx and page2.aspx

In page1.aspx i have Gridview, when i click particular row using select command button. I want to display one column value in second page.

In Second page i have label to display the selected row column value.

can you please help.

how to pass column value to another page using label.

Thanks....

推荐答案

您可以使用 HttpResponse.Redirect 传递您的列值方法



在用户点击命令按钮时获取perticluar列值,然后将其传递给HttpResponse.Redirect方法如下

You can pass your column value using HttpResponse.Redirect Method

get the perticluar column value when user clicks on command button and then pass it to HttpResponse.Redirect Method as follows
Response.Redirect("page2.aspx?ColumnVal=" + Column_Value+ "");





然后从你的page1.aspx页面得到如下



Then from your page1.aspx page get it like below

string value = Request.QueryString["ColumnVal"];





然后你可以把它分配给你的标签



你也可以使用Session状态传递它们


为会话分配列值



then you can assign it to your lable

Also you can pass them using Session state

in page1.aspx assign column value to a session

Session["ColumnVal"] = "Column_Value";





然后在你的page2.aspx你可以这样得到它



then in your page2.aspx you can get it like this

string value= (string)(Session["ColumnVal"]);





参考这篇MSDN文章



http://msdn.microsoft.com/e n-us / library / vstudio / 6c3yckfw(v = vs.100).aspx [ ^ ]


这篇关于如何使用第二页上的标签将Gridview列值显示到另一页面。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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