المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Need to add 1 to a cache value



C# Programming
06-13-2010, 10:22 AM
I have a label called lblsite that I'm trying to give a value from a cached value.

protected void Page_Load(object sender, System.EventArgs e)
{
lblsite.Text = (Cache("locid") + 1);
} The "locid" is set on the previous page.

protected void btnaddaddress_Click(object sender, System.EventArgs e)
{
Cache["locid"] = gvaddressmax.SelectedRow.Cells[0].Text;
Response.Redirect("btnaddaddress.aspx");
}
However, the lblsite.Text = (Cache("locid") + 1); gives me the following error and results in a null value.

'System.Web.Caching.Cache' is a Type, but being used like a variable

How can I get this to work?