Hi.
I have a datatable where text entered in textbox will be saved in temporary data table,without sending to database.
Now,when i click at other menu in the page and click back at the temporary data table,the datatable will be cleared because it reloads when we click at any menus in the page.
I want the page to be static,without reload/refresh.The page is in content holder in master page.
Any ideas guys?
Loading
Bechir BejaouiPosted Sep 18, 2010, 6:44 AM
Add a global asax to your project, try to set the session there
http://aspalliance.com/1114_Understanding_the_Globalasax_file.all
samPosted Sep 18, 2010, 12:11 AM
Based on your code,i do in this way :
but my data still dissapears when i click at another link and click at this table link back.
Is my code here right?
[code]
protected void Page_Load(object sender, EventArgs e)
{
{
if (!Page.IsPostBack)
{
//Instantiating the DataTable;
dt = new DataTable("Table1");
Session["Table1"] = dt;
//Adding Columns
dt.Columns.Add("name", typeof(string));
{
if (Session["Table1"] != null)
{
dt = (DataTable)Session["Table1"];
}
}
}
}
}
[/code]
Bechir BejaouiPosted Sep 13, 2010, 7:07 AM
http://aspalliance.com/1114_Understanding_the_Globalasax_file.all
The Cache could be defined as you like you can define it within the scope of the page if you want
samPosted Sep 12, 2010, 9:11 PM
Where do i apply this code?
This session and caching is new to me.
Bechir BejaouiPosted Sep 9, 2010, 12:33 PM
I can propose you more than one solution in that case. You can cache that data table. To cache the data table you have Session and Cache objects
To set caching
Session["yourdatatablename"] = yourdatatable
or
Cache["yourdatatablename"] = yourdatatable
To retrieve cache after several post backs use this syntax
DataTable table = (DataTable)Session["yourtablename"];
or
DataTable table = (DataTable)Cache["yourtablename"];
Use session to cache data for a unique user
Use cache to cache date for a set of users
You can use the View state to hold objects between postback too but in one situation. I mean when you're still making post back at the same page
Of Corse, you can bind your grid view to that cached data table instead of the normal data table
samPosted Sep 8, 2010, 10:36 PM
Bechir BejaouiPosted Sep 8, 2010, 10:32 PM
Are using a gridview control to load data?