Link to home
Create AccountLog in
Avatar of ike2010
ike2010

asked on

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_cs.txt
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


Avatar of Type25
Type25

In login.cs  

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

to

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.
ASKER CERTIFIED SOLUTION
Avatar of laotzi2000
laotzi2000

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
surely the problem is  TextMode="Password"  isn't supported by a standard input text control ????