Where Should Store A Data Table ViewState/ Session/ Cache

Apr 21, 2010

I have a DataTable with about 10,000 rows in it.

I would like to store this data once for aspx page. When the user selects different options in the page, data is further selected from the already stored DataTable.

I tried using the ViewState, but as soon as the data grows beyond 100 rows, performance degrades.

View 1 Replies


Similar Messages:

C# - Store Viewstate In The Session Rather Than Bulking Up The HTML

Jan 7, 2011

I'm trying to get asp.net to store viewstate in the session rather than bulking up the html.

Now i've read that asp.net comes with the SessionPageStatePersister which can be used instead of the default HiddenFieldPageStatePersister to do this. I was wondering how i go about dropping it in?

This is what i've got so far:

I think i need to create a PageAdapter that returns a SessionPageStatePersister from its GetStatePersister method, and somehow get the page to use this pageadapter. But Page.PageAdapter only has a getter, so i'm not sure how you set it.

See the 'remarks' heading here: [URL]

View 3 Replies

State Management :: Store Viewstate In Session ( Framework 3.5, VS 2008 )?

Nov 9, 2010

I need to store viewstate in session to optimize my page performance on postback.

I am developing ASP.Net Website, using Visual Studio 2008.

I created a class named "BasePage" under "App_Code".

[Code]....

Now, I know if I inherit this class in all of my pages, that will work but I am looking to do this through Config file.

Is there any way that I can write something in Config file to use this class for all the pages?

so that if I want to remove, I can simply remove from config file and I do not need to compile my whole project again.

View 4 Replies

Forms Data Controls :: Store Gridview Datatable In Session And Then Retrieve From Session And Store Database

Nov 11, 2010

Its related to datatable in gridview store in session and then session retrive and store to database. basically i am using gridview here creating new row for button click and these row adding untill user's last entry then submit all these entry to database. so i want to use session variable to store this data temporarily and after final entry user click on submit button and all data shold be save in db.

View 9 Replies

SQL Server :: Can Explicitly Store Data Into Buffer Cache

Dec 13, 2010

one of my stored procedure has 4 select statments and gets data from large tables,

can i explicitly store result of stored procedure into buffer cache?,

and when calling stored procedure, than returns data from buffer cache?

View 2 Replies

C# - Store Dynamically Changing Data Into Server Cache?

Apr 7, 2010

EDIT: Purpose of this Website: Its called Utopiapimp.com. It is a third party utility for a game called utopia-game.com. The site currently has over 12k users to it an I run the site. The game is fully text based and will always remain that. Users copy and paste full pages of text from the game and paste the copied information into my site. I run a series of regular expressions against the pasted data and break it down. I then insert anywhere from 5 values to over 30 values into the DB based on that one paste. I then take those values and run queries against them to display the information back in a VERY simple and easy to understand way. The game is team based and each team has 25 users to it. So each team is a group and each row is ONE users information. The users can update all 25 rows or just one row at a time. I require storing things into cache because the site is very slow doing over 1,000 queries almost every minute.

So here is the deal. Imagine I have an excel EDIT(Excel is just an example of how to imagine it, I don't actually use excel) spreadsheet with 100 columns and 5000 rows. Each row has two unique identifiers. One for the row it self and one to group together 25 rows a piece. There are about 10 columns in the row that will almost never change and the other 90 columns will always be changing. We can say some will even change in a matter of seconds depending on how fast the row is updated. Rows can also be added and deleted from the group, but not from the database. The rows are taken from about 4 queries from the database to show the most recent and updated data from the database. So every time something in the database is updated, I would also like the row to be updated. If a row or a group has not been updated in 12 or so hours, it will be taken out of Cache. Once the user calls the group again via the DB queries. They will be placed into Cache.

The above is what I would like. That is the wish.In Reality, I still have all the rows, but the way I store them in Cache is currently broken. I store each row in a class and the class is stored in the Server Cache via a HUGE list. When I go to update/Delete/Insert items in the list or rows, most the time it works, but sometimes it throws errors because the cache has changed. I want to be able to lock down the cache like the database throws a lock on a row more or less. I have DateTime stamps to remove things after 12 hours, but this almost always breaks because other users are updating the same 25 rows in the group or just the cache has changed.This is an example of how I add items to Cache, this one shows I only pull the 10 or so columns that very rarely change. This example all removes rows not updated after 12 hours:

DateTime dt = DateTime.UtcNow;
if (HttpContext.Current.Cache["GetRows"] != null)
{

[code]...

View 4 Replies

New-Cache Parameters For AppFabric Cache When Storing.NET Session State

Jul 28, 2010

What are the "optimal" parameters for creating an AppFabric cache when you will be storing session state in the cache? MSDN Cache-Related Commands

Powershell command line:

New-Cache [-CacheName] <String> [-Eviction <String>] [-Expirable <String>] [-Force [<SwitchParameter>]] [-NotificationsEnabled <String>] [-Secondaries <Int32>] [-TimeToLive <Int64>]

[code]...

Since I don't want my sessions to be removed unless the session has been abandoned either via code or Session Timeout...For eviction, I would think "None" and for expireable, I would think False.I have tested and calling Session.Abandon does remove the object from the cache. I have also tested to see if by extending my session, the session object in cache is also extended. This does seem to work the "correct" way.

View 1 Replies

Javascript - How To Store Value To ViewState

Jan 26, 2011

I can tried save some data to ViewState, but i get this Error:

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Error serializing value 'HeRMeSSAAS.BussinesProcess.BussinesServices.CandidateService' of type 'HeRMeSSAAS.BussinesProcess.BussinesServices.CandidateService.'
Code:

private IActionService ActionService
{
get [code]...
How i can store value to ViewState?

View 2 Replies

C# - Store A Queue In Viewstate?

Apr 29, 2010

EDIT: ViewState does not change when browser is refreshed, so even if you write to viewstate it will not save the data. i am trying to store a Queue in a viewstate (to track postbacks and refreshes to stop a form from resubmitting). The Queue is only saving with a count of 1 (the first item that is added to it) no matter how many items i add.

// New Queue of strings
private Queue<string> sTemp;
private Queue<string> p_tempQue
{
set
{
ViewState["sTemp"] = value;
}
get
{
return (Queue<string>)ViewState["sTemp"];
}
}
//BasePage constructor
public BasePage()
{
//create a Queue of string
//sTemp = new Queue<string>();
this.Load += new EventHandler(this.Page_Load);
this.Init += new EventHandler(this.Page_Init);
}
//In the 'page_Init' event we have created a simple hidden field by name 'hdnGuid' which is attached to the page on the first hit itself.
protected void Page_Init(object sender, EventArgs e)
{
//initializing the hidden field
//create a hidden field with a ID
HiddenField hdnGuid = new HiddenField();
hdnGuid.ID = "hdnGuid";
//if it is the first time the page is loaded, create a new guid and assign it as the hidden field value
if (!Page.IsPostBack)
hdnGuid.Value = Guid.NewGuid().ToString();
//add the hidden field to the page
Page.Form.Controls.Add(hdnGuid);
}
//In the 'page_Load' event we check if the hidden field value is same as the old value. In case the value is not same that means it's a 'postback'
//and if the value is same then its 'refresh'. As per situation we set the 'httpContent.Items["Refresh"]' value.
protected void Page_Load(object sender, EventArgs e)
{
if(p_tempQue != null)
sTemp = p_tempQue;
else
sTemp = new Queue<string>();
//The hdnGuid will be set the first time page is loaded, else the hdnGuid
//will be set after each time the form is submitted using javascript.
//assign the hidden field currently on the page for manipulation
HiddenField h1 = (HiddenField)(Page.Form.FindControl("hdnGuid"));
//create an instance of the GuidClass
GuidClass currentGuid = new GuidClass();
//set the GuidClass Guid property to the value of the hidden field
currentGuid.Guid = h1.Value;
//check to see if the Queue of strings contains the string which is the current Guid property of the GuidClass
//if the are equal, then the page was refreshed
if (sTemp.Contains<string>(currentGuid.Guid))
{
//adds item as key/value pair to share data between an System.Web.IHttpModule interface and an System.Web.IHttpHandler interface during an HTTP request.
System.Web.HttpContext.Current.Items.Add("IsRefresh", true);
}
//if they are not requal, the page is not refreshed
else
{
//if the current Guid property in the GuidClass is not null or not an empty string
//add the new Guid to the Queue
if (!(currentGuid.Guid.Equals(null) || currentGuid.Guid.Equals("")))
sTemp.Enqueue(currentGuid.Guid);
System.Web.HttpContext.Current.Items.Add("IsRefresh", false);
}
p_tempQue = sTemp;
}

View 3 Replies

How To Store A Byte[] List In Viewstate

Feb 6, 2011

I want to store some byte[] to ViewState. For example I want to store a list of FileBytes. How can I do it?

View 1 Replies

C# - How To Store And Retrieve A Particular Segment From The Cache

Mar 8, 2011

It should store plain HTML fragments of a page like the standard Output cache in asp.net .The HTML may contain dynamic content from a database.When an object is updated in the database all the cached HTML fragment containing that particular object should be destroyed and re-cached next time it will be requested.

There is a separate admin tool to handle all data in the database so I can easy store the Id's in a cachetable when an object is invalid. I can also make a request to a page that destroy all cached HTML fragment for that object.

But when I write the markup, how could I do to store and retrieve a particular segment from the cache? Of cause I could do this in code behind and have the markup in a string but I don't want that. I want to have the markup as intact as possible.

View 2 Replies

Store Viewstate Other Than In Hidden Field

Jan 30, 2010

can we store viewstate other than in hidden field in asp.net

View 2 Replies

.net - Browser Store The Cache Item?

Jan 24, 2011

If i enable client side cache in my asp.net application where it store that cache controls in my computer

View 1 Replies

Asp.net - Store Unserializable Objects Into The Cache?

Mar 3, 2011

I've seen numerous examples of people storing DataTables into the Cache, but I am just wondering, do the same rules apply to the Cache that apply to the Session? The one rule I am most concerned with is:Do not store unserializable objects into the Session. Just because you can doesn't mean it is guaranteed to work So ultimately my question is:Can you store unserializable objects into the Cache?I reasearched this for a while, reading numerous posts and even reading the chapter about Cache in my ASP.NET 3.5 book and I cannot find it anywhere.I am going to put my DataTable into a DataSet then into the Cache,but is this necessary?

View 3 Replies

Data Controls :: Insert Data From GridView Bound Using ViewState To Database Table

Jan 7, 2014

how to insert data in DB table from view state gridview ?

protected void Page_Load(object sender, EventArgs e)
       {
           if (!this.IsPostBack)
           {
               this.GetMaxId();
               this.GetPersons();
        
[code]...

View 1 Replies

Data Controls :: How To Check Transaction ID From SQL Table In ViewState GridView

Jan 5, 2014

how to write a code to check the Transaction ID from SQL Table in view state gridview for each row data ?

For Example, select transID from Table.Current ID is 14481. 

So now when i add in the view state grid view, it show the same trans number

Is it any method to write the + values in add row function in c# to increase the values ? as below is the c# code.  

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

[Code].....

View 1 Replies

C# - Store Data From A Form For Recovery From The Session?

Feb 15, 2011

I need to store data from a form for recovery from the session.

Below is my rough first attempt for a generalized method for textboxes:

Load Session:

[code]....

However, it appears that the Controls collection is not working for me. What am I doing wrong?

this.Controls.OfType<TextBox>() yields no results at run time when I do a quick watch on it.

View 4 Replies

Session, FormsAuthenticationTicket, Store Data About The User?

Feb 1, 2011

I'm am building an web application that needs to be able to scale.We want to store, an connection string, an object that says what organization the user is working on right now and the identity of the user.

We could serialize down this and send through the userdata property in the FormsAuthenticationTicket, but that feels to not be the optimal solution, cause its is 4-5 strings of data that is unncessesary, but the main issue is that we are sending an encrypted connectionstring to the user which we dosent want to.

So what are our options?Can ASP.NET Cache be our solution?, can we couple the expiration of the asp.net cache and the formsauthenticationcookie?

View 2 Replies

State Management :: How To Store List In ViewState

May 27, 2010

I want to store List<Class> object to ViewState, when i try to do this than its giving me error to make class serialize,but my class is partial class so didn't get serialize keyword on class how can i store List object to viewstate.

View 4 Replies

State Management :: How To Store IQueryable Value In ViewState

Jan 3, 2011

i want to store IQueryable value to ViewState. my code is as below:

Private
Property _Query()
As IQueryable
Get
Return
CType(ViewState("_Query"), IQueryable)
End
Get
Set(ByVal value
As IQueryable)
ViewState("_Query") = value
End
Set

but when i run my page i get following error:

Type 'System.Data.Linq.DataQuery`1[[DynamicQueries.VW_EmployeeProfile_Filter, DynamicQueries, ersion=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' in Assembly 'System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable

what should i do to get rid of this error. previously i was doing like this:

Private Shared _Query As IQueryable

but problem is that in Multi users environament, Shared variable is making problem, that is why i want to store it in ViewState.

View 4 Replies

Configuration :: Serialize An Object To Store In ViewState?

Aug 6, 2010

Why to Serialize an object to store in ViewState?

View 1 Replies

C# - Store Class Properties In Session And Use Of Session Handler - Is It Good Design

Jul 27, 2010

I have a class called EditMapUtilities. Here are some class properties that I want to persist:

public class EditMapUtlities
{
public static Boolean isInitialEditMapPageLoad
{
get { return SessionHandler.isInitialEditMapPageLoad; }
set { SessionHandler.isInitialEditMapPageLoad = value; }
}
// REST OF CLASS NOT GERMAIN TO DISCUSSION AND OMITTED
}

Here is my SessionHandler Class following the pattern from this post Static Session Class and Multiple Users:
using System.Web.SessionState;

public static class SessionHandler
{
private static HttpSessionState currentSession
{
get
{
if (HttpContext.Current.Session == null)
throw new Exception("Session is not available in the current context.");
else
return HttpContext.Current.Session;
}
}
//A boolean type session variable
private static string _isInitialEditMapPageLoad = "EditMapInitialPageLoad";
public static bool isInitialEditMapPageLoad
{
get
{
if (currentSession[_isInitialEditMapPageLoad] == null)
return true;
else
return (Boolean)currentSession[_isInitialEditMapPageLoad];
}
set
{
currentSession[_isInitialEditMapPageLoad] = value;
}
}
}

I am still learning OOAD. I want to keep relevant properties with relevant classes. I also want to keep all Session stored variables in one place for ease of maintenance and to encapsulate the session keys and calls. I feel like my design is too coupled though. How can I make it more loosely coupled? Is my editMapUtilities class too tightly coupled to the SessionHandler class? How would you do it better?

View 2 Replies

Store Form Data In Tables For User Session?

Jan 5, 2010

I am using Visual Studio 2008.

I created a New Project ASP.NET Web Application.

I created a Textbox named VisitorName. The visitor puts in their name and it goes in VisitorName.Text

There is a Label that says "Which do you own?"

There is a RadioButtonList. It has Cat, Dog and None.

There is a button that says Add to list.

The button needs to add the results of the above items and put them in the list.

Now you keep adding people and their pets.

Once there are all entered you press send and I get the results for everyone entered during that session via email.

I have no database access and the information does not need to be stored in such a way.

I would like to use a datatable or datalist or something to that sort.

Oh and I would like the visitor to be able to click on a name in the table and edit the data using the form controls not in the datalist or datatable itself.

View 8 Replies

Data Controls :: How To Store Session Variable In Database

Jul 23, 2013

i want to store  Session["Name"] into databse "name" column. how to do this ?

View 1 Replies

Web Forms :: How To Store Multi Dimensional Array To Viewstate?

Oct 8, 2010

How do you store multi-dimensional array to viewstate? Here's what I did:
public bool[,,] regsettings = new bool[7,5,4];
bool[,,] regsettings = (bool[,,])ViewState["regsettings"]; // this line works!
regsettings[i,j,tab] = (bool)ViewState["regsettings"]; // this line no working?! The error is: Object reference not set to an instance of an object. The letters i,j, tab are just variables in the loop. They are there. I also tried: (bool[,,,]) as a cast and it is a no-go either.?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved