Here is the error as it appears in my browser:
Expand|Select|Wrap|Line Numbers
- Compilation Error
- 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.
- Compiler Error Message: CS0654: Method 'Chapter7.SingleBind.GetImageURL()' referenced without parentheses
- Source Error:
- 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"
- Line 17: runat="server" Font-Names="Trebuchet MS" Font-Size="X-Small" Width="100px" Height="30px"><%# ImageURL %>
- 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 %>">
- Line 19: </asp:image><asp:label id="Label4" style="Z-INDEX: 105; LEFT: 293px; POSITION: absolute; TOP: 131px" runat="server"
- 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"
Expand|Select|Wrap|Line Numbers
- using System;
- using System.Collections;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Web;
- using System.Web.SessionState;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.HtmlControls;
- namespace Chapter7
- {
- /// <summary>
- /// Summary description for Products.
- /// </summary>
- public class SingleBind : System.Web.UI.Page
- {
- protected System.Web.UI.WebControls.Label lblImageURL;
- protected System.Web.UI.WebControls.Image imgImageURL;
- protected System.Web.UI.WebControls.Label Label4;
- protected System.Web.UI.WebControls.Label Label5;
- protected System.Web.UI.WebControls.Label Label7;
- protected System.Web.UI.WebControls.TextBox txtImageURL;
- //protected System.Web.UI.HtmlControls.HtmlInputText txtImageURL;
- protected System.Web.UI.WebControls.Label Label1;
- protected string ImageURL
- {
- get
- {
- return "logo.gif";
- }
- }
- protected string GetImageURL()
- {
- return "images/logo.gif";
- }
- private void Page_Load(object sender, System.EventArgs e)
- {
- Page.DataBind();
- // Put user code to initialize the page here
- }
- #region Web Form Designer generated code
- override protected void OnInit(EventArgs e)
- {
- //
- // CODEGEN: This call is required by the ASP.NET Web Form Designer.
- //
- InitializeComponent();
- base.OnInit(e);
- }
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.Load += new System.EventHandler(this.Page_Load);
- }
- #endregion
- }
- }
Expand|Select|Wrap|Line Numbers
- <%@ Page Language="c#" AutoEventWireup="false" Codebehind="SingleBind.aspx.cs" Inherits="Chapter7.SingleBind" %>
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
- <HTML>
- <HEAD>
- <title></title>
- <meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
- <meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
- <meta content="JavaScript" name="vs_defaultClientScript">
- <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
- </HEAD>
- <body MS_POSITIONING="GridLayout">
- <form id="Form1" method="post" runat="server">
- <IMG style="Z-INDEX: 101; LEFT: 4px; POSITION: absolute; TOP: 6px" src="images/header2.jpg">
- <IMG style="Z-INDEX: 102; LEFT: 21px; POSITION: absolute; TOP: 96px" src="images/menu.gif">
- <asp:label id="Label1" style="Z-INDEX: 109; LEFT: 218px; POSITION: absolute; TOP: 71px" runat="server"
- 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"
- runat="server" Font-Names="Trebuchet MS" Font-Size="X-Small" Width="100px" Height="30px"><%# ImageURL %>
- </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 %>">
- </asp:image><asp:label id="Label4" style="Z-INDEX: 105; LEFT: 293px; POSITION: absolute; TOP: 131px" runat="server"
- 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"
- 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"
- 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>
- </body>
- </HTML>