Problems with my webusercontroler(Parser error)
-
24-06-2021 - |
Question
I have made a webusercontrol on my asp.net webforms application. But I get this parser error when I try to run it
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: Unknown server tag 'uc1:WebUserControl1'.
I have this code in my sitemaster:
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<uc1:WebUserControl1 ID="WebUserControl11" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
And this is my WebUserControl that I created in my solution:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl1.ascx.cs" Inherits="GameShops.WebUserControl1" EnableViewState="true" %>
<asp:Panel ID="Panel1" runat="server">
<asp:Label ID="usrlblAntalVaror" runat="server" Text="Inga Varor"></asp:Label>
<asp:Label ID="usrlblTotalpris" runat="server" Text="0 kr"></asp:Label>
<br />
<asp:DropDownList ID="usrDdlVaror" runat="server" Height="25px" Width="148px"
AutoPostBack="True" EnableViewState="True">
</asp:DropDownList>
<asp:ImageButton ID="usrbtnTabort" runat="server" AlternateText="Ta Bort"
Height="26px" ImageUrl="~/Image/RecycleBin.png" Width="29px" CommandName="usrbtnTabort_click" OnCommand="usrbtnTabort_click" />
<br />
<br />
<asp:Button ID="usrTillKassanBtn" runat="server" Text="Till Kassan"
onclick="usrTillKassanBtn_Click" />
</asp:Panel>
<p></p>
Any help is appreciated!
Solution
You need to register the usercontrol on your master page.
<%@ Register Src="~/WebUserControl.ascx" TagName="WebUserControl1" TagPrefix="uc1" %>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow