How to store a dataset in a viewstate?




Answers were Sorted based on User's Feedback



How to store a dataset in a viewstate?..

Answer / kinjal panchal

when you add dataset into dataAdupter like

dataset ds=new dataset();
dataAdupter da=new dataAdupter();
da.fill(ds);

then create one stringwriter
system.io.strinwriter sw=new system.io.stringwriter();

your dataset write into this stringwriter
ds.writeXML(sw);
viewstate["ds"]=sw.tostring();

Is This Answer Correct ?    3 Yes 1 No

How to store a dataset in a viewstate?..

Answer / kundal singh

DatasetAdapter sda = new DatasetAdapter("select * from
tablename");

Dataset ds = new Dataset();
sds.fill(ds);

ds.Tables[0].TableName = "tablename";
sda.Fill(ds, "tablename");
sda.Fill(StartIndex, Numbers, ds.Tables)
sda.Fill(0, 25, dt);
sda.Fill(25, 200, ds.Tables["tablename"]);

Is This Answer Correct ?    0 Yes 0 No

How to store a dataset in a viewstate?..

Answer / alb.shah

Dataset can be stored in the viewstate. any object that
can be serializable can be stored in the viewstate. We can
serialize the dataset and then can be saved int he
viewstate..

Is This Answer Correct ?    4 Yes 6 No



Post New Answer



More ASP.NET Interview Questions

How many classes can a single .NET DLL contain?

2 Answers  


What does mean by a neutral culture?

0 Answers   MindCracker,


When would you set a control's AutoPostBack property to true?

1 Answers  


If i have a page where i create an instance of a dll and without invoking any method can I send values to next page ?

1 Answers   Satyam,


How can we make sure that Web API returns JSON data only?

0 Answers  






what is reference type to value type.

3 Answers   AG Technologies,


Best Institute in india for online training (Dotnet/java/Tibco/Dwh/etc.....)

4 Answers  


What namespace does the Web page belong in the .NET Framework class hierarchy?

3 Answers   Siebel Systems,


What are the objects of ASP.NET ?

6 Answers  


Define caching.

0 Answers  


What is session tracking & methods?

4 Answers   C Squared Systems,


What are the page level transaction and class level transaction?

1 Answers   Satyam,






Categories