none
'System.Web.UI.WebControls.TextBox' does not contain a definition for 'InnerHtml' and ...

    Spørgsmål

  • Hi,
    I have the problems (the following is one of those) with the codes below.

    Error 4 'System.Web.UI.WebControls.TextBox' does not contain a definition for 'InnerHtml' and no extension method 'InnerHtml' accepting a first argument of type 'System.Web.UI.WebControls.TextBox' could be found (are you missing a using directive or an assembly reference?)  

    Here is the markup file of 'Start.aspx'

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Start.aspx.cs" Inherits="Newsite._Default" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head id="Head1" runat="server">
        <title>Login Page</title>
        <link href="format.css" originalAttribute="href" originalPath=""format.css"" originalAttribute="href" originalPath="format.css" originalAttribute="href" originalPath="format.css" rel="stylesheet" type="text/css" media="screen" />
    </head>
    <body>
        <form id="form1" runat="server">
       <b>LOGIN:</b><br />
       UserID: <asp:TextBox ID="LoginUserIDTextBox" runat="server"></asp:TextBox> <span id="Userid" runat="server" /> <br />
       Password: <asp:TextBox ID="PasswordTextBox" runat="server" TextMode="Password"> </asp:TextBox> <span id="loginpassword" runat="server" />
       <br /><br />
        <asp:Button ID="LoginButton" runat="server" Text="Login"
            onclick="LoginButton_Click" />
       <br /><br />
        </form>
    </body>
    </html>

    Here is 'Start.aspx.cs'

    using System;
    using System.Text; // This was needed to make ASCIIEncoding function
    using System.Collections.Generic;
    using System.Linq;
    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 System.Data.SqlClient;
    using System.Configuration;
    using System.Data.OracleClient;
    using System.Security.Cryptography; // This was needed to make everything related to MD5 function

    namespace NewSite
    {
        public partial class _Default : System.Web.UI.Page
        {
            TextBox LoginUserIDTextBox, PasswordTextBox, Userid;
            string tempString;
            OracleConnection conn = new OracleConnection();

            protected void Page_Load(object sender, EventArgs e)
            {

            }

            protected void LoginButton_Click(object sender, EventArgs e)
            {
                if (LoginUserIDTextBox.Text == "")
                {
                    Userid.InnerHtml = "(1) Please type your User ID...";
                }
                else
                {
                    if (Session["UserName"] == "")
                    {
                        Userid.InnerHtml = "(2) Incorrect UserID...";
                    }
                    else
                    {
                        if (PasswordTextBox.Text == "")
                        {
                            loginpassword.InnerHtml = "(3) Please type in your password...";
                        }
                        else
                        {
                        }
                    }
                }
            }

        }
    }

    Here is the last one - 'Start.aspx.designer.cs'
    //------------------------------------------------------------------------------
    // <auto-generated>
    //     This code was generated by a tool.
    //     Runtime Version:2.0.50727.3053
    //
    //     Changes to this file may cause incorrect behavior and will be lost if
    //     the code is regenerated.
    // </auto-generated>
    //------------------------------------------------------------------------------

    namespace Newsite {
       
       
        public partial class _Default {
           
            /// <summary>
            /// Head1 control.
            /// </summary>
            /// <remarks>
            /// Auto-generated field.
            /// To modify move field declaration from designer file to code-behind file.
            /// </remarks>
            protected global::System.Web.UI.HtmlControls.HtmlHead Head1;
           
            /// <summary>
            /// form1 control.
            /// </summary>
            /// <remarks>
            /// Auto-generated field.
            /// To modify move field declaration from designer file to code-behind file.
            /// </remarks>
            protected global::System.Web.UI.HtmlControls.HtmlForm form1;
           
            /// <summary>
            /// LoginUserIDTextBox control.
            /// </summary>
            /// <remarks>
            /// Auto-generated field.
            /// To modify move field declaration from designer file to code-behind file.
            /// </remarks>
            protected global::System.Web.UI.WebControls.TextBox LoginUserIDTextBox;
           
            /// <summary>
            /// Userid control.
            /// </summary>
            /// <remarks>
            /// Auto-generated field.
            /// To modify move field declaration from designer file to code-behind file.
            /// </remarks>
            protected global::System.Web.UI.HtmlControls.HtmlGenericControl Userid;
           
            /// <summary>
            /// PasswordTextBox control.
            /// </summary>
            /// <remarks>
            /// Auto-generated field.
            /// To modify move field declaration from designer file to code-behind file.
            /// </remarks>
            protected global::System.Web.UI.WebControls.TextBox PasswordTextBox;
           
            /// <summary>
            /// loginpassword control.
            /// </summary>
            /// <remarks>
            /// Auto-generated field.
            /// To modify move field declaration from designer file to code-behind file.
            /// </remarks>
            protected global::System.Web.UI.HtmlControls.HtmlGenericControl loginpassword;
           
            /// <summary>
            /// LoginButton control.
            /// </summary>
            /// <remarks>
            /// Auto-generated field.
            /// To modify move field declaration from designer file to code-behind file.
            /// </remarks>
            protected global::System.Web.UI.WebControls.Button LoginButton;
        }
    }


    Thanks & Best Regards, HuaMin Chen
    17. februar 2009 02:59

Svar