Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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....
Posted

1 solution

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
C#
Response.Redirect("page2.aspx?ColumnVal=" + Column_Value+ "");


Then from your page1.aspx page get it like below
C#
string value = Request.QueryString["ColumnVal"];


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
C#
Session["ColumnVal"] = "Column_Value";


then in your page2.aspx you can get it like this
C#
string value= (string)(Session["ColumnVal"]);


Refer this MSDN article

http://msdn.microsoft.com/en-us/library/vstudio/6c3yckfw(v=vs.100).aspx[^]
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900