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

Which method is used to enforce garbage collection in .net?

0 Answers  


Define web services in asp.net.

0 Answers  


Which .NET framework supports Web API?

0 Answers  


What is the application pool?

0 Answers  


What are app services?

0 Answers  






If I am developing an application that must accomodate multiple security levels though secure login and my asp.net web application is spanned across three web-servers (using round-robin load balancing). What would be the best approach to maintain login-in state for the users?

0 Answers  


In Crystal Report Refresh Button is not working. when I click on it it givesh error like "missing parameter values " I have used propery of Crystal Viewer like ReuseParameterValuesOnRefresh="True" but this also not working. Plz give me any solution.

1 Answers  


What is difference between asp state management and asp.net state management?

0 Answers  


What are standard controls?

0 Answers  


Define xmlreader class.

0 Answers  


What is the Difference B/W Finalize() and Dispose() in .Net?

12 Answers   HCL, IBM,


hi i am varinder. i am very eager to learn ASP.net in C#. i am beginer to it. i have refer some books but i found it tuff to understand. their language is tuff. So please tell me the best site or best book to learn ASP.net in C#. i will be very thankful. Varinder

1 Answers  


Categories