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

If I have more than one version of one assemblies, then how will I use old version (how/where to specify version number?) In my application?

0 Answers  


How to count the number of objects present in a web page? How to count the number of radio buttons in a web page?

0 Answers   HCL,


What is data cache in sql server?

0 Answers  


What Are Different Types of Debbugers

2 Answers   Accenture, TCS, Wipro,


What is an asp.net validator? And, mention its types.

0 Answers  






Explain about Multi-Language integration?

0 Answers  


What do you mean by serialize and marshalbyref?

0 Answers  


What is the use of web.config and machine.config files?

0 Answers   Amdocs,


Explain how cookies work.

0 Answers  


What's the advantage of using System.Text.StringBuilder over System.String?

3 Answers   IBM, IdeaLake, Infosys,


Is It Possible For Whole Page is Saved In View State? What Is View State?

2 Answers   Phoenix Technologies,


What is the use of ASP.NET routing?

0 Answers  


Categories