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

a web application needs to be created to accept the product name and quantity of a toy from a customer. After the customer has entered the product name the application needs to display the discounted price of the product to the customer (company is offering 35% discount on all products). The application should allow the customer to select the product name from a list box. and also while i'm data binding to a label with custom data binding with some declarations : "The Discounted Price is "+((System.Convert.todouble(lblprodprice.text)*(system.convert.todouble(txtqty.text)) - ((System.convert.todouble(lblprodprice.text)*(system.convert.todouble(txtqty.text)*0.35)). Where i need to give this declaration in asp.net 2.0.

0 Answers   Netsweeper,


In which scenario we use Session and Cookies? With Example..

1 Answers  


Is it possible to disable the minimized icon of a popup window using window.open. Not using iframe concept?

3 Answers   AFAS, Take United,


How to check the end of the record in Datareader?

2 Answers   Cognizant,


explain store procedure and trigger

3 Answers  






How do you relate an aspx page with its code behind page ?

4 Answers   Accenture, BirlaSoft,


Explain what is clr?

0 Answers  


What is the importance of aspnet_isapi.dll, inetinfo.exe andaspnet_wp.exe in the page loading process.

0 Answers   Siebel,


Define msil.

0 Answers  


What are the advantages of the code-behind feature?

0 Answers  


Why we go for mvc instead of asp.net? : Asp.Net MVC

0 Answers  


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

0 Answers   Siebel,


Categories