Can you store dataset in viewstate?

Answer Posted / lalit pradhan

//Create new dataset :
DataSet ds = new DataSet();
//Store the dataset directly into view state
ViewState["dsn"]=ds;
//retrieve the dataset where it required
DataSet ds = (DataSet)ViewState["dsn"];
GridView1.DataSource = ds.Tables[0];
GridView1.DataBind();

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why does my asp.net file have multiple tag with runat=server?

571


If there are multiple update panels on the page say upd1 and upd2. There is a button placed in upd1. How can you stop upd2 to update when button placed in upd1 is clicked?

566


How do u deploy your asp.net application?

610


Explain what is postback in asp. Net?

547


How does windows service lifecycle differ from a .standard. Exe?

512






How can u deifne the benefits and limitation of using Viewstate for state management?

706


How do I upload a file from my ASP.NET page?

591


Why do we need url encoding?

522


What is the importance of Global.asax in ASP.NET?

549


How to find last error which occurred in Asp.net ?

681


What is Difference between Production Serves and Development Servers? And Suppose, m adding/deleting C# file in a project based on the Specific Requirement. These Files are Automatically updated in Production Servers? So Which tool is needed to do This One?

1504


What is a web farm?

594


What is ispostback property?

501


Describe the method to create a permanent cookie?

579


What is the difference between dynamic SGA and static SGA?

584