Matt Scilipoti's WebLog

.NET et al

Strange Error: in ASP.

Strange Error. Happened with Literal too. Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: The base class includes the field 'ConstructIDLabel', but its type (System.Web.UI.WebControls.Label) is not compatible with the type of control (System.Web.UI.WebControls.TextBox). Source Error:
Line 14: <table>
Line 15: 	<tr>
Line 16: 		<td><asp:TextBox id="ConstructIDLabel" runat="server"></asp:TextBox></td>
Line 17: 		<td><asp:TextBox id="ConstructIDTextBox" runat="server" Text='<%# DataBinder.Eval(DataView1, "[0].ConstructID") %>'></asp:TextBox></td>
Line 18: 	</tr>

Comments

Alex Lowe said:

Just a guess but I'd say that (in your codebehind or somewhere in your script tags) you have an object named 'ConstructIDLabel' and it is of type System.Web.UI.WebControls.Label. So, you have a private member variable of one type and a static control declaration of a different type. Change the private member variable so that it is of type System.Web.UI.WebControls.TextBox and all will be well.
# February 25, 2003 7:48 PM

Matt Scilipoti said:

That was it. There were quite a few declares left after I deleted the original controls.
Thanks.
# February 28, 2003 3:11 PM

yildiz said:

thanks a lot alex.
# April 28, 2003 4:36 PM

James McFarland said:

I had this problem too.

The problem was that I changed the type of a server control instance on an aspx page, but did not change the id.

Thus, the code-behind class for my aspx page still had the declaration for the control with the old type, while the aspx was claiming it was something else.

Invoking the desiger in VS.NET updates the declaration to the right type (or you could change it by hand in the code behind.

Thanks for the posting Alex.

-james
# April 12, 2004 4:45 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)