• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 677
  • Last Modified:

Parser error: Base class, type mismatch

Hello all. I have a login page that uses a web form textbox for the username and web form textbox for the password. Everything compiles fine, but when my browser tries to load the page I get a parser error:

"The base class includes the field 'txtPassword', but its type (System.Web.UI.HtmlControls.HtmlInputText) is not compatible with the type of control (System.Web.UI.WebControls.TextBox)."

Line 86: <td width="10" height="17"></td>
Line 87: <td height="17">
Line 88: <asp:TextBox id="txtPassword" runat="server" width="150" TextMode="Password"></asp:TextBox></td>
Line 89: </tr>
Line 90: <tr>

The interesting thing here is that txtPassword is not of type System.Web.UI.HtmlControls.HtmlInputText. I create the textbox by dragging the TextBox tool from the Web Forms tool box. Also, in my code behind I call txtPassword.Text and it works everywhere else in my web app. Any ideas? Thanks.

Here is my code:

http://www.geocities.com/eric_eichler/login.txt  (you'll have to 'view source' to see the code on this one)

server is running Windows Server 2003

  • 2
  • 2
1 Solution
In login.cs  

change   protected System.Web.UI.HtmlControls.HtmlInputText txtUserName;


protected System.Web.UI.HtmlControls.TextBox txtUserName;
I think the code is all right.
You should rebuild the project and run it again.
I guess you used html server control before and replaced it with web form control and something is still there.
especially the code behind dll.
From your code, you're mixing vb and c#, so I don't think the dll will be deployed automatically.
surely the problem is  TextMode="Password"  isn't supported by a standard input text control ????

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now