System.Web.UI.Page.Cache is a 'property' but is used like a 'method'


if (Cache("MyData") == null)
{
ds = myclasslibrary.lookupIDs();  <<filling dataset
if (ds != null)
{
if (ds.Tables[0].Rows.Count > 0)
{
ddl.DataTextField =
"Text";
ddl.DataValueField =
"ID";
ddl.DataSource = ds;
ddl.DataBind();
Cache.Insert("MyData", ds, null,DateTime.Now.AddMinutes(5), Cache.NoSlidingExpiration);
}
}
else
{
ds = ((
DataSet) (Cache("MyData")));
}

error:

System.Web.UI.Page.Cache is a 'property' but is used like a 'method'


Its all about coding!
-1
nisarkhan
5/18/2006 2:14:50 PM
asp.net.web-forms 93655 articles. 3 followers. Follow

2 Replies
1397 Views

Similar Articles

[PageSpeed] 25

Change the 2 lines that say Cache("MyData") to be Cache["MyData"] instead.

If this post answered your question please remember to 'Mark as Answer'!
1
bpag
5/18/2006 3:30:40 PM

thank you and i realize after i post.

how the cache will take care if i have a new data in the table ?


Its all about coding!
1
nisarkhan
5/18/2006 4:14:02 PM
Reply:

Similar Artilces:

'System.Web.UI.IDataItemContainer.DataItem' is a 'property' but is used like a 'method'
On the line "<%# Container.DataItem("BlogID") %>", I get the error listed in the title of this post. I'm not sure why, I use this same for on other pages to get data from a database and I don't get this error.         <asp:GridView ID="GridView1"         runat="server"         AutoGenerateColumns="False"         DataKeyNames="BlogID"        D...

Can any one help due to this problem Error 1 'System.Web.UI.Page.Application' is a 'property' but is used like a 'method'
Hi all ! while creating application,session variables i am getting this problem can u suggest any one. Error 1 'System.Web.UI.Page.Application' is a 'property' but is used like a 'method'  lokesh   As a general guideline for seeking help, always show the code that is not working for you.  Your description alone is not enough for us to be able to help you. Alister kplokesh: Hi all ! while creating application,session variables i am getting this problem can u suggest any one. Error 1 'System.Web.UI.Page.Application' is a 'property' but is us...

'System.Web.UI.WebControls.DataListItem.DataItem' is a 'property' but is used like a 'method'
 HI I have a datalist with OnItemDataBoundI get the following error when I try to get the DataItem 'System.Web.UI.WebControls.DataListItem.DataItem' is a 'property' but is used like a 'method' , any idea what's wrong with the line ?  public void Item_Bound(object sender, DataListItemEventArgs e)    {        Label originalPriceLabel;        if (e.Item.ItemType == ListItemType.Item | e.Item.ItemType == ListItemType.AlternatingItem)        {    &n...

'System.Web.HttpContext.Session' is a 'property' but is used like a 'method
Hello, I'm trying to set my sessions into a class so I can set and access it easily. I get a 'System.Web.HttpContext.Session' is a 'property' but is used like a 'method' error, can you see what's wrong with my code ?  Thanks  public class SessionManager    {                public static bool isLogged        {            get        &nb...

Compiler Error Message: CS0118: 'System.Web.Caching.Cache' is a 'type' but is used like a 'variable'
What am I missing??????????using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using com.amazon.webservices; using System.Web.Caching; /// <summary> /// Summary description for AmazonWS /// </summary> public class AmazonWS { public AmazonWS() { } public static DataSet AmazonToDataSet(string powersearchstring) { DataSet ds; //is it in the cache? if (Cache[powersearchstring] == null) { //create our query ItemSearchResponse response ...

System.Web.UI.Page.Request' denotes a 'property' where a 'method; was expected
i have create a datalist that displays book titles once click the hiperlink takes you to an edit page. the hyperlink looks like this. <asp:hyperlink id="link" Runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "Title" )%>' NavigateURL='<%# Request.ApplicationPath + "/edit.aspx?id=" + DataBinder.Eval(Container.DataItem, "ref_id" ) %>'/> my problem is as follow when i get to the edit page. instead of displaying one record at a time it displays all records one after the other one. I have tried to use the follow...

CS0118: 'System.Web.UI.WebControls.DataGridItem.DataItem' denotes a 'property' where a 'method' was expected
Hai .....,            In my datagrid, I would to display information using this ItemTemplate tag. But when i execute my page, I get the following error:CS0118: 'System.Web.UI.WebControls.DataGridItem.DataItem' denotes a 'property' where a 'method' was expected            In VB.NET, it is working perfectly but in C# it's not. I know to display data using DataBinder.Eval(Container.DataItem, "Field"), but would like Container.DataItem("Field") to work. Regards,HemantThanx and Regar...

'System.Web.UI.Control.Context' denotes a 'property' where a 'class' was expected
I get the following error when trying to compile my project. The call to Context lies in a usercontrol. It works fine when called from a page, but how do I call it from a usercontrol? private User _currentUser = new User(Context.User.Identity.Name); 'System.Web.UI.Control.Context' denotes a 'property' where a 'class' was expected Firefox - The browser you can trust Update: private User _currentUser = new User(Context.User.Identity.Name);Is declared inside the class, not in a function. Like: public class Someclass : System.Web.UI.UserControl { private User _currentUser = new...

Error: Cannot convert type 'System.Web.UI.Control' to 'System.Web.UI.WebControls.ButtonField'
Hello, I am getting the following error during compiliation. Any suggestions to fix it. Thanks. Cannot convert type 'System.Web.UI.Control' to 'System.Web.UI.WebControls.ButtonField' protected void gvEvents_RowCommand(Object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Select") { int index = Convert.ToInt32(e.CommandArgument); GridViewRow selectedRow = gvEvents.Rows[index]; string sID; ButtonField btn; if (selectedRow.RowType == DataControlRowType.DataRow) { sID = ((ButtonField)selectedRow.FindControl("ID")).DataTextFi...

System.Data.DataSet.Tables' is a 'property' but is used like a 'method'?
     private void PassID(string x)    {        //string strConnection = System.Configuration.ConfigurationManager.ConnectionStrings("FasR6ConnectionString").ConnectionString;        string strConnection = System.Configuration.ConfigurationManager.AppSettings["FasR6ConnectionString"].ToString();         SqlConnection objConnection = new SqlConnection(strConnection);        string query = "spGetEm...

''System.Web.UI.UserControl' does not have a public property named 'Title'.
The controls work but I cannot view them in designer I get an error: Error 1 Content1:Type 'System.Web.UI.UserControl' does not have a public property named 'Title'. D:\asp.net\Atlas\SampleWebSite\ModalPopup\ModalPopup.aspx D:\...\SampleWebSite\ I saw another post that said to rebuild, but I tried that and it didn't work. thanks! Nevermind... found the answer to remove the collapible panels.  Wait until next release. ...

Method not found: 'Void System.Web.UI.ScriptManager.RegisterHiddenField(System.Web.UI.Page, System.String, System.String)'
I downloaded the 10618 version and can not get it working.  The sample website that comes with the release gives me this error on every page I try to browse. Method not found: 'Void System.Web.UI.ScriptManager.RegisterHiddenField(System.Web.UI.Page, System.String, System.String)' Stack Trace: [MissingMethodException: Method not found: 'Void System.Web.UI.ScriptManager.RegisterHiddenField(System.Web.UI.Page, System.String, System.String)'.]   AjaxControlToolkit.ToolkitScriptManager.OnLoad(EventArgs e) +0   System.Web.UI.Control.LoadRecursive() +47&n...

'DataItem' is not a member of 'System.Web.UI.Page'
I am getting this error when compiling the following code: <%@ Import Namespace="System.IO"%><%@ Import Namespace="System.Data.OleDb"%><%@ Import Namespace="System.Data"%><script language="VB" runat="server"> Dim savePath As String = "C:\upload\"Sub Upload_Click(source As Object, e As EventArgs)   If Not (uploadedFile.PostedFile Is Nothing) Then    Try      Dim postedFile = uploadedFile.PostedFile      Dim filename As String = Path.GetFi...

''''''''''''''''''''
Name: haznen Email: haznenatyahoodotcom Product: Gran Paradiso Alpha 8 Summary: '''''''''''''''''''' Comments: '''''''''''''''''''''''''''''''''''' Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061204 UGES/1.7.2.0 GranParadiso/3.0a1 From URL: http://www.mozilla.org/projects/granparadiso/ Note to readers: Hendrix gives...

Web resources about - System.Web.UI.Page.Cache is a 'property' but is used like a 'method' - asp.net.web-forms

Resources last updated: 12/13/2015 8:05:38 AM