The base class includes the field 'btnLogin', but its type (FoodOrder.App_Code.LinkButtonDefault) is not compatible with the type of control (FoodOrder.App_Code.LinkButtonDefault).
aspx:
<%@ Register Namespace="FoodOrder.App_Code" TagPrefix="ac1" %>
<ac1:LinkButtonDefault ID="btnLogin" runat="server" Text="Prijava" CssClass="gumbek"
onclick="btnLogin_Click" />
LinkButtonDefault:
namespace FoodOrder.App_Code
{
public class LinkButtonDefault : LinkButton
{
protected override void OnLoad(System.EventArgs e)
{
Page.ClientScript.RegisterStartupScript(GetType(), "addClickFunctionScript",
_addClickFunctionScript, true);
string script = String.Format(_addClickScript, ClientID);
Page.ClientScript.RegisterStartupScript(GetType(), "click_" + ClientID,
script, true);
base.OnLoad(e);
}
private const string _addClickScript = "addClickFunction('{0}');";
private const string _addClickFunctionScript =
@" function addClickFunction(id) {{
var b = document.getElementById(id);
if (b && typeof(b.click) == 'undefined') b.click = function() {{
var result = true; if (b.onclick) result = b.onclick();
if (typeof(result) == 'undefined' || result) {{ eval(b.getAttribute('href')); }}
}}}};";
}
}
aspx.designer.cs:
protected global::FoodOrder.App_Code.LinkButtonDefault btnLogin;
Can someone explain me error?
I think you have a circular reference occuring with the App_Code folder.
MS recommends two approaches to fix: http://support.microsoft.com/kb/919284
Either modify the web.config to set the <compilation>
element to false (only recommended for small applications)
OR
Reorder the folders in your application. AKA - put your link button class somewhere else.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With