So I have a file called WebParts.aspx which looks like this -
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebParts.aspx.cs" Inherits="e.WebParts" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<div>
<asp:TabContainer ID="TabContainer1" runat="server">
<asp:TabPanel ID="TabPanel1" runat="server">
<ContentTemplate>Page One</ContentTemplate>
</asp:TabPanel>
<asp:TabPanel ID="TabPanel2" runat="server">
<ContentTemplate>Page Two</ContentTemplate>
</asp:TabPanel>
<asp:TabPanel ID="TabPanel3" runat="server">
<ContentTemplate>Page Three</ContentTemplate>
</asp:TabPanel>
</asp:TabContainer>
</div>
</form>
</body>
</html>
And that produces the desired results of creating 3 tab panels inside a tab container.
However, when I change that page to use a MasterPage.master to look like this -
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebParts.aspx.cs" Inherits="eservice.WebParts" MasterPageFile="~/MasterPage.Master"%>
<asp:Content ID="Content2"
ContentPlaceHolderID="ContentPlaceHolder1"
runat="server">
<asp:LoginView ID="LoginView1" runat="server">
<LoggedInTemplate>
<p id="backtoblog"></p>
<p> Preferences</p>
<div>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<div>
<asp:TabContainer ID="TabContainer1" runat="server">
<asp:TabPanel ID="TabPanel1" runat="server">
<ContentTemplate>Page One</ContentTemplate>
</asp:TabPanel>
<asp:TabPanel ID="TabPanel2" runat="server">
<ContentTemplate>Page Two</ContentTemplate>
</asp:TabPanel>
<asp:TabPanel ID="TabPanel3" runat="server">
<ContentTemplate>Page Three</ContentTemplate>
</asp:TabPanel>
</asp:TabContainer>
</div>
</div>
</LoggedInTemplate>
<AnonymousTemplate>
You are not logged in.
<br />
Please login to access eservice
</AnonymousTemplate>
</asp:LoginView>
</asp:Content>
VS2008 gives me the following warning:
Element 'ToolkitScriptManager' is not a known element. This can occur if there is a compilation error in the Web site, or the web.config file is missing.
on the following line:
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
Your second file does not contain the line
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
which you have in your first file. Just because the master page knows about the asp:
prefix and the assembly/namespace you've associated to it, doesn't mean that the child page does.
A better approach would be to register the assembly/namespace/tag prefix inside your web.config, like so:
<configuration>
<!-- ... -->
<system.web>
<!-- ... -->
<pages>
<controls>
<add tagPrefix="asp"
namespace="AjaxControlToolkit"
assembly="AjaxControlToolkit" />
</controls>
</pages>
</system.web>
</configuration>
Element 'ToolkitScriptManager' is not a known element. This can occur if there is a compilation error in the Web site, or the web.config file is missing.
Just in case someone runs across this. The fix for me, was that the imported project properties pointed to 4.5.2 framework. I selected an older framework, and then selected 4.5.2 again. This got rid of the mentioned error along with dozens of others.
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