Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4.5 > ASP.NET 4.5 General Discussion
|
ASP.NET 4.5 General Discussion For ASP.NET 4.5 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4.5 General Discussion section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 23rd, 2013, 11:36 AM
Registered User
 
Join Date: Sep 2013
Posts: 12
Thanks: 5
Thanked 0 Times in 0 Posts
Default hello how should i use sesions on gridview?

how can I pass a string from a form to another using

try
{
int number;
number= Convert.ToInt16(e.CommandArgument);
if (e.CommandName == "Detalle")
{
//here goes the id that i want to traspass
Session["id"] = dtgBusqueda.Rows[number].Cells[0].Text;
Response.Redirect("frmFormTo.aspx");
}
}
catch (Exception ex)
{
lblMen.Text = "Error: " + ex.Message;
}
 
Old September 23rd, 2013, 12:37 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

This looks fine to me; in the other form you can then use:

Code:
string id = Session["id"] as string;
to retrieve the value again.

Does this not work for you?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
The GridView 'GridView' fired event PageIndexChanging which wasn't handled Phil Critchley ASP.NET 4 General Discussion 10 February 19th, 2011 09:55 AM
gridview nested gridview phuchoang2583 ASP.NET 3.5 Basics 0 January 26th, 2011 12:08 AM
Copy One Row from Gridview to Gridview lvprasad2007 ASP.NET 2.0 Professional 0 July 28th, 2009 08:29 AM
Get GridView Cell Value Based on GridView Column stublair C# 2008 aka C# 3.0 0 September 4th, 2008 08:30 AM
Creating Sesions aadz5 ASP.NET 1.0 and 1.1 Basics 4 December 17th, 2003 04:18 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.