Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Caching / January 2004

Tip: Looking for answers? Try searching our database.

Datagrid; session state with dataviews and performance

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Michael Johnson Sr. - 26 Jan 2004 03:16 GMT
I have a dataview, which is populated from data in a database.

I am storing this datagrid data in a dataview so I can sort it easily
(Dataview.sort() ), so I decided to turn off viewstate for the datagrid, to
send less traffic.  So I cut the page from 111k down to about 50k in size,
but I need to call DataGrid.Source= and DataGrid.DataBind() on post back for
sorts, once on SortCommand (after sorting the dataview) and then again on
PageLoad (because data will not be available to sort when SortCommand is
called if it isn't bound, since I disabled viewstate).

Is there any problems with this?  I figured storing the dataview in session
memory for sorting, I should just as well use it to repopulate the grid
rather than sending it all through viewstate.  Providing this doesn't pose
memory problems on the server is this appoach acceptable?
Alvin Bruney [MVP] - 26 Jan 2004 14:43 GMT
very acceptable. I'm not sure how you are getting the sorting to work
without re-hooking the grid events in page_load. Is this a custom sort?
Anyway, the viewstate portion is a very effective performance optimization
technique.

Signature

Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b

> I have a dataview, which is populated from data in a database.
>
[quoted text clipped - 10 lines]
> rather than sending it all through viewstate.  Providing this doesn't pose
> memory problems on the server is this appoach acceptable?
Michael Johnson Sr. - 26 Jan 2004 17:07 GMT
I was doing the following in page_load:

 private void Page_Load(object sender, System.EventArgs e)
 {
  if (!IsPostBack)
  {
   sqlDataAdapter1.Fill(dataSet11);

   Session["dataView"] = dataSet11.Tables["Customers"].DefaultView;
   ViewState["Sort"] = string.Empty;
   ViewState["SortDirection"] = "ASC";
  }

   DataGrid1.DataSource = Session["dataView"];
   DataGrid1.DataBind();

 }

Then i reset the datasource and databind in the SortCommand.  I disabled
ViewState on the DataGrid.

I understand this will cause alot of memory use for large applications if
the dataview gets large or alot of users.  The fix for this would to
re-query the database instead of storing the dataview on the session stack,
I assume.

> very acceptable. I'm not sure how you are getting the sorting to work
> without re-hooking the grid events in page_load. Is this a custom sort?
[quoted text clipped - 18 lines]
> > rather than sending it all through viewstate.  Providing this doesn't pose
> > memory problems on the server is this appoach acceptable?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.