Grid in ASP.Net like Windows Forms

A

Alfredo

Hi,

I have a question. Is it possible reproduce the behavior of windows
forms datagrid in asp.net? For example, I want to fill the grid, but
the data must not be inserted in my database. I think use a dataset in
session or viewstate, but i think this is very heavy, what do you think
? do you have any example? or url?

Thanks,

Alfredo Barrientos
 
G

Grant Merwitz

A dataset does have a lot of overhead, and is costly to Session and
Viewstate

Try using something like an array which is less costly
This can too be bound to a datagrid
 
A

Alfredo Barrientos

Hi Grant,

An Array or an ArrayList? Which is the least costly?

In Viewstate or session?

Is there any way to get a dataset from datagrid viewstate?

Thanks,

Alfredo Barrientos
 
G

Grant Merwitz

Hey Alfredo.

Sorry, went home friday evening before i saw your question.

Array vs. ArrayList

An Array is the least costly, as an ArrayList has alot of built in
functionality which make them much easier to use.
E.g.
with an Array you have to specify the size of it when you instantiate it,
whereas an Arraylist you don't
An ArrayList infact sits between a DataSet and Array in terms of
functionality and overhead.

I often use ArrayLists to get my data initially, then use the
ArrayList.ToArray function to get them to an Array.

I would say these type of objects are better to session than viewstate.
The reason being is the Viewstate can get really big and can slow down the
page load time.
Also, sometimes you get the Infamous Viewstate errors which are painfull to
fix up.

But then again, you don't exactly want to punish your server with sessions,
as that can slow down the whole site and not just a given user on a given
page.
Ultimately, you should be using your Cache (that is for general data, not
client specific - i.e. like a list of countries, not a users answers to a
questionairre)


DataSet from DataGrid

you can get a DataSet from a DataGrid, you'll need to cast its datasource.
Something like
DataSet ds = (DataSet)MyDataGrid.DataSource;

Good luck
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top