473,322 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

CS0654: Method 'Chapter7.SingleBind.GetImageURL()' referenced without parentheses

Hello, I am currently working on an ASP.NET web application. When I compile my code behind the page, I do not get any errors ;however, when I attempt to view my code in a browser I get the error that is the title of this post. I am going to include a copy of my code behind the page, and my .aspx file code, can anyone help me out here? I am using Visual Studio.NET 2003, and my code behind the page is written in C#.

Here is the error as it appears in my browser:
Expand|Select|Wrap|Line Numbers
  1. Compilation Error 
  2. Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 
  3.  
  4. Compiler Error Message: CS0654: Method 'Chapter7.SingleBind.GetImageURL()' referenced without parentheses
  5.  
  6. Source Error:
  7.  
  8.  
  9.  
  10. Line 16:                 Font-Names="Trebuchet MS" ForeColor="DarkSlateGray" Font-Size="Medium">Single Data Binding</asp:label><asp:label id="lblImageURL" style="Z-INDEX: 104; LEFT: 168px; POSITION: absolute; TOP: 132px"
  11. Line 17:                 runat="server" Font-Names="Trebuchet MS" Font-Size="X-Small" Width="100px" Height="30px"><%# ImageURL %>
  12. Line 18:             </asp:label><asp:textbox id=txtImageURL style="Z-INDEX: 110; LEFT: 167px; POSITION: absolute; TOP: 193px" runat="server" Width="104px" Text="<%# ImageURL %>"></asp:textbox><asp:image id=imgImageURL style="Z-INDEX: 108; LEFT: 166px; POSITION: absolute; TOP: 255px" runat="server" ImageUrl="<%# GetImageURL %>">
  13. Line 19:             </asp:image><asp:label id="Label4" style="Z-INDEX: 105; LEFT: 293px; POSITION: absolute; TOP: 131px" runat="server"
  14. Line 20:                 Font-Names="Trebuchet MS" Font-Size="X-Small" Width="184px" Height="38px">Displays the image name using an ASP.NET label control</asp:label><asp:label id="Label5" style="Z-INDEX: 106; LEFT: 293px; POSITION: absolute; TOP: 194px" runat="server"
  15.  
  16.  
  17.  
Here is my code behind the page:
Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Collections;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Web;
  7. using System.Web.SessionState;
  8. using System.Web.UI;
  9. using System.Web.UI.WebControls;
  10. using System.Web.UI.HtmlControls;
  11.  
  12. namespace Chapter7
  13. {
  14.     /// <summary>
  15.     /// Summary description for Products.
  16.     /// </summary>
  17.     public class SingleBind : System.Web.UI.Page
  18.     {
  19.         protected System.Web.UI.WebControls.Label lblImageURL;
  20.         protected System.Web.UI.WebControls.Image imgImageURL;
  21.         protected System.Web.UI.WebControls.Label Label4;
  22.         protected System.Web.UI.WebControls.Label Label5;
  23.         protected System.Web.UI.WebControls.Label Label7;
  24.         protected System.Web.UI.WebControls.TextBox txtImageURL;
  25.         //protected System.Web.UI.HtmlControls.HtmlInputText txtImageURL;
  26.         protected System.Web.UI.WebControls.Label Label1;
  27.  
  28.         protected string ImageURL 
  29.         {
  30.             get 
  31.             {
  32.                 return "logo.gif";
  33.             }
  34.         }
  35.         protected string GetImageURL()
  36.         {
  37.                 return "images/logo.gif";
  38.         }
  39.         private void Page_Load(object sender, System.EventArgs e)
  40.         {
  41.             Page.DataBind();
  42.             // Put user code to initialize the page here
  43.         }
  44.  
  45.         #region Web Form Designer generated code
  46.         override protected void OnInit(EventArgs e)
  47.         {
  48.             //
  49.             // CODEGEN: This call is required by the ASP.NET Web Form Designer.
  50.             //
  51.             InitializeComponent();
  52.             base.OnInit(e);
  53.         }
  54.  
  55.         /// <summary>
  56.         /// Required method for Designer support - do not modify
  57.         /// the contents of this method with the code editor.
  58.         /// </summary>
  59.         private void InitializeComponent()
  60.         {    
  61.             this.Load += new System.EventHandler(this.Page_Load);
  62.  
  63.         }
  64.         #endregion
  65.     }
  66. }
  67.  
And here is my .aspx file in its entirity:
Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="c#" AutoEventWireup="false" Codebehind="SingleBind.aspx.cs" Inherits="Chapter7.SingleBind" %>
  2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  3. <HTML>
  4.     <HEAD>
  5.         <title></title>
  6.         <meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
  7.         <meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
  8.         <meta content="JavaScript" name="vs_defaultClientScript">
  9.         <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
  10.     </HEAD>
  11.     <body MS_POSITIONING="GridLayout">
  12.         <form id="Form1" method="post" runat="server">
  13.             <IMG style="Z-INDEX: 101; LEFT: 4px; POSITION: absolute; TOP: 6px" src="images/header2.jpg">
  14.             <IMG style="Z-INDEX: 102; LEFT: 21px; POSITION: absolute; TOP: 96px" src="images/menu.gif">&nbsp;&nbsp;
  15.             <asp:label id="Label1" style="Z-INDEX: 109; LEFT: 218px; POSITION: absolute; TOP: 71px" runat="server"
  16.                 Font-Names="Trebuchet MS" ForeColor="DarkSlateGray" Font-Size="Medium">Single Data Binding</asp:label><asp:label id="lblImageURL" style="Z-INDEX: 104; LEFT: 168px; POSITION: absolute; TOP: 132px"
  17.                 runat="server" Font-Names="Trebuchet MS" Font-Size="X-Small" Width="100px" Height="30px"><%# ImageURL %>
  18.             </asp:label><asp:textbox id=txtImageURL style="Z-INDEX: 110; LEFT: 167px; POSITION: absolute; TOP: 193px" runat="server" Width="104px" Text="<%# ImageURL %>"></asp:textbox><asp:image id=imgImageURL style="Z-INDEX: 108; LEFT: 166px; POSITION: absolute; TOP: 255px" runat="server" ImageUrl="<%# GetImageURL %>">
  19.             </asp:image><asp:label id="Label4" style="Z-INDEX: 105; LEFT: 293px; POSITION: absolute; TOP: 131px" runat="server"
  20.                 Font-Names="Trebuchet MS" Font-Size="X-Small" Width="184px" Height="38px">Displays the image name using an ASP.NET label control</asp:label><asp:label id="Label5" style="Z-INDEX: 106; LEFT: 293px; POSITION: absolute; TOP: 194px" runat="server"
  21.                 Font-Names="Trebuchet MS" Font-Size="X-Small" Width="192px" Height="40px">Display the image name in an ASP.NET textbox control</asp:label><asp:label id="Label7" style="Z-INDEX: 107; LEFT: 293px; POSITION: absolute; TOP: 254px" runat="server"
  22.                 Font-Names="Trebuchet MS" Font-Size="X-Small" Width="190px" Height="54px">Displays the image name in an ASP.NET image button control</asp:label></form>
  23.     </body>
  24. </HTML>
  25.  
Any help that could be provided in this area, would be greatly appreciated.
Feb 21 '07 #1
1 2557
I figured it out just now, I needed to remove the "get" statement in the C# code, and I needed to add "()" to "ImageURL" and "GetImageURL" in the code behind the page, and all of the databinding statments: < %ImageURL() %>
Feb 21 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

30
by: Martin Bless | last post by:
Why can't we have an additional 'print' statement, that behaves exactly like 'print' but doesn't insert that damn blank between two arguments? Could be called 'printn' or 'prin1' or 'prinn'...
4
by: Steve | last post by:
Hi I have decided it is time to learn Javascript (I know PHP fairly well, so I thought it shouldn't be too difficult!!!) I have a couple of question though, which I can highlight with the...
1
by: Max Adams | last post by:
Using System.Timers.ElapsedEventHandler to specify a method and and ElapsedEventArgs object I've trawled the internet looking for some help on this topic. What I want to do is, every x seconds...
28
by: Howard Bryce | last post by:
I have come across code containing things like sizeof int How come that one can invoke sizeof without any parentheses surrounding its argument? Is this admissible within the standard? Can it...
8
by: gilad | last post by:
hi, I would like to get the address of a class method in an instance. In the following sample the third like access the method. how can I get the address into a long variable - something like -...
19
by: zzw8206262001 | last post by:
Hi,I find a way to make javescript more like c++ or pyhon There is the sample code: function Father(self) //every contructor may have "self" argument { self=self?self:this; ...
2
by: Kevin Walzer | last post by:
I am trying to structure a Tkinter application with classes instead of just with simple functions, but I'm not sure how to call methods from my main class. My main class is packetstreamApp()....
11
by: placid | last post by:
Hi all, Is it possible to be able to do the following in Python? class Test: def __init__(self): pass def puts(self, str): print str
3
by: Lyn | last post by:
Can anyone explain this for me? A sub procedure can be called with or without parentheses around the arguments. By personal convention, I normally use parentheses. I am in the middle of a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.