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 do you specify whether your data should be passed as Query string and Forms (Mainly about POST and GET)

2 Answers  


What are the data types is possible to store in session? and can we store dataset in session?

4 Answers   eMids,


How many rounds are there for a software programmer to clear interview in any IT industries(MNC).

3 Answers   HCL,


How can I create master page in asp net?

0 Answers  


What is the Difference between MVC And MVP design pattrens

0 Answers   Symphony,






What is a url string?

0 Answers  


Why web api is better than wcf?

0 Answers  


What are the Types of authentications in IIS

0 Answers   Microsoft,


Advantage of Update Panel over Asp.net 2.0 + C#+ Microsoft Ajax 1.0

1 Answers   InfoSpace,


Define Query Interface,Adref,Release?

1 Answers   Microsoft,


Suppose there is one web farm with 3 servers inside with same configuration and the same project is running inside all servers.Which session mode is usde for all these and why?

3 Answers  


What is difference between session and viewstate?

0 Answers  


Categories