Can you store dataset in viewstate?

Answers were Sorted based on User's Feedback



Can you store dataset in viewstate?..

Answer / rajamurugesh

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

Is This Answer Correct ?    44 Yes 7 No

Can you store dataset in viewstate?..

Answer / shashikesh mishra

yes.We can store dataset in view state.Not a dataset any
serialible object type(datatable,dataset etc..) to be store
in view state.

Is This Answer Correct ?    23 Yes 5 No

Can you store dataset in viewstate?..

Answer / 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

Can you store dataset in viewstate?..

Answer / masthan

yes,you can store dataset into viewstate directly.
dataset ds=new dataset();
viewstate["newds"]=ds;
datagrid1.dataspurce=(dataset)viewstatw["newds"];
datagrid.databind();

Is This Answer Correct ?    4 Yes 2 No

Can you store dataset in viewstate?..

Answer / chinmoy

Yes, you can store any serializable data in viewstate.

Is This Answer Correct ?    3 Yes 2 No

Can you store dataset in viewstate?..

Answer / venkat

//create datatable
datatable dt = new datatable();
//Create new dataset :

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

Is This Answer Correct ?    1 Yes 3 No

Can you store dataset in viewstate?..

Answer / mansing patil

No, You cant directly store Dataset in ViewState. You can
get XML from dataset store that Xml in ViewState. While
getting From ViewState convert to xml and then from xml to
dataset



Is This Answer Correct ?    9 Yes 22 No

Post New Answer

More ASP.NET Interview Questions

What is custom events? How to create it?

0 Answers  


Authentication and Authorization

2 Answers   Syntel,


After building the custom control, you test it by adding an ASP.Net web application to the solution. You add a correct <%@ Register %> directive and a proper declaration of the control in the <asp:Form> tag to the Web Form, but when you execute the application you get an error. What is the most likely reason for the problem? a) The custom control must be compiled first. b) The web application must have a reference to the control c) The custom control must be registered with windows first. d) The assembly from the custom control is not in the application?s bin directory.

1 Answers   Syntax Softtech,


Diff between web user control and web custom control?

0 Answers  


Web API uses which library for JSON serialization?

0 Answers  






Define a web service in .net?

0 Answers  


What is caching in asp.net?

0 Answers  


How do you set language in web.cofig ?

3 Answers   Keane India Ltd,


What is Partial in ASP.NET 2.0?

2 Answers   Fulcrum Logic,


What is the purpose of the validation summary control? What do you need to do to prevent an error message from being displayed in a validator when a validation summary control is used? How can you display a message in both the validator and the validation summary control?

2 Answers  


When using the Pager object, inorder to know which page to go, which property you have to set to grid?

0 Answers   Siebel,


Why do I get error message "could not load type" whenever I browse to my asp.net web site?

0 Answers  


Categories