Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hi
 
I have created a web application in C# .net4.0.In that application, i want to pass data present in a DATASET from one form to another and i want to place that data in the textboxes present in the 2nd form. How can i do that? Plz help me
 
Thanking you
Posted 21-May-12 19:44pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

Hi ,
You can use Session
 //for assign
        DataSet ds = new DataSet();
        Session.Add("Name", ds);
        // for retrieve
        ds = (DataSet)Session["Name"];
Exploring Session in ASP.NET[^]
Session management options in ASP.NET[^]
Session Management in ASP.NET[^]
ASP.NET Session Management Internals[^]
http://msdn.microsoft.com/en-us/library/ms178581.aspx[^]
Best Regards
M.Mitwalli
  Permalink  
Comments
VJ Reddy at 22-May-12 23:09pm
   
5!
Mohamed Mitwalli at 23-May-12 3:25am
   
Thanks VJ :)
Prasad_Kulkarni at 23-May-12 3:29am
   
Good references! 5!
Mohamed Mitwalli at 23-May-12 3:32am
   
Thanks Prasad :)
Mohammad A Rahman at 23-May-12 6:26am
   
my 5!
Mohamed Mitwalli at 23-May-12 8:13am
   
Thanks Mohammad :)
member60 at 26-May-12 5:29am
   
my 5!
Mohamed Mitwalli at 26-May-12 8:04am
   
Thanks member60 :)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 6

  Permalink  
Comments
Prasad_Kulkarni at 23-May-12 0:33am
   
Good links +5!
P.Salini at 23-May-12 4:48am
   
Thank you Prasad.
Mohammad A Rahman at 23-May-12 6:27am
   
my 5!
P.Salini at 23-May-12 7:01am
   
Thank you Rahman
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 7

Client Side:
View State – Asp.Net uses View State to track the values in the Controls. You can add custom values to the view state. It is used by the Asp.net page framework to automatically save the values of the page and of each control just prior to rendering to the page. When the page is posted, one of the first tasks performed by page processing is to restore view state.
Control State – If you create a custom control that requires view state to work properly, you should use control state to ensure other developers don’t break your control by disabling view state.
Hidden fields – Like view state, hidden fields store data in an HTML form without displaying it in the user's browser. The data is available only when the form is processed.
Cookies – Cookies store a value in the user's browser that the browser sends with every page request to the same server. Cookies are the best way to store state data that must be available for multiple Web pages on a web site.
Query Strings - Query strings store values in the URL that are visible to the user. Use query strings when you want a user to be able to e-mail or instant message state data with a URL.
 
Server Side:
Application State - Application State information is available to all pages, regardless of which user requests a page.
Session State – Session State information is available to all pages opened by a user during a single visit.
Both application state and session state information is lost when the application restarts. To persist user data between application restarts, you can store it using profile properties.
 
See the references in all above answers they are having more details with examples.
  Permalink  
Comments
Mohamed Mitwalli at 23-May-12 3:34am
   
5+ for your explanation :)
Prasad_Kulkarni at 23-May-12 3:37am
   
Thank you
P.Salini at 23-May-12 4:48am
   
My 5!
Prasad_Kulkarni at 27-Jun-12 5:12am
   
Thank yo P.Salini!
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi,
 
save dataset in application state like following
sqlDataAdapter1.Fill(dSet);
System.IO.StringWriter sw = new System.IO.StringWriter();
 
// Write the DataSet to the Application state.
dSet.WriteXml(sw);
Application["dSet"] = sw.ToString();
 
then u can use it in any page
 
best luck
happy codingSmile | :)
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

By using State management concept you will pass data from one page to another
 
see this links you may get some idea
http://www.dotnetfunda.com/articles/article61.aspx[^]
 
http://msdn.microsoft.com/en-us/library/75x4ha6s.aspx[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 8

Hi,
you can use Session for pass the value from one page to another page.
 
Session
 
From Page:
DataSet ds = new DataSet();
Session["var"] = ds.Tables[0];
 
To Page:
DataSet ds = new DataSet();
ds = (DataSet)Session["var"];
 

 

 
Regards,
Jitendra
  Permalink  
v4
Comments
jitu8187 at 23-May-12 13:45pm
   
Dear Mitwalli, If you will see right side, i have already cast session variable in DataSet. so we have to take a DataSet in left side. Regards, Jitendra

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 530
1 OriginalGriff 379
2 Manas Bhardwaj 350
3 Abhinav S 295
4 Sampath Lokuge 255
0 Sergey Alexandrovich Kryukov 7,647
1 OriginalGriff 4,287
2 Peter Leow 3,681
3 Maciej Los 3,515
4 Er. Puneet Goel 3,107


Advertise | Privacy | Mobile
Web03 | 2.8.140415.2 | Last Updated 23 May 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid