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.
Related
I am getting the Content controls error in my Master page. I did not leave any tag opened but still getting this error. Can somebody look at my code and point me to my mistake for correction? Can somebody explain me the error via this example?
<%# Master Language="C#" MasterPageFile="~/Data.master" AutoEventWireup="true" CodeFile="IMS.master.cs" Inherits="ims_IMS" %>
<%# MasterType VirtualPath="~/AData.master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="contenttop" Runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="content" Runat="Server">
<div id="section-header" class="clear">
<h2 id="section-title">IMS </h2>
</div>
<de:PageSecurity ID="ps1" runat="server" ContentControlId="contentwrapper" AllowdeStaff="True" AllowTechss="False" AllowPeoples="False" AllowDistrict="True" ErrorMessage="You cannot access this page." />
<div id="section-content">
<asp:ContentPlaceHolder ID="sectioncontent" Runat="Server">
</asp:ContentPlaceHolder>
</div>
</asp:Content>
I'd recommend you remove everything from inside <asp:Content ID="Content3" and see if you still get an error.
Also, try ending your custom control with /> instead of /de>
<asp:scriptmanager id="ScriptManager1" runat="server" xmlns:asp="#unknown"></asp:scriptmanager>
<asp:button id="Button1" runat="server" onclick="Button1_Click" text="Button" xmlns:asp="#unknown" />
<rsweb:reportviewer id="ReportViewer2" runat="server" height="261px" width="476px" xmlns:rsweb="#unknown"></rsweb:reportviewer>
I've followed all tutorials exactly (or so I think) and I can't get a modal window to open. Right now, I'm just trying to get one to open in a "test" ASP page, so I can figure out the functionality.
Here is my code for "Test.aspx"
<%# Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="Test.aspx.vb" Inherits="Test" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="act"%>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<act:ModalPopupExtender ID="MPE" runat="server"
TargetControlID="LinkButton1"
PopupControlID="Panel1"
OkControlID="OkButton"
BackgroundCssClass="modalBackground"></act:ModalPopupExtender>
<asp:Panel ID="Panel1" runat="server" CssClass="ModalWindow">
<asp:Table Width="100%" runat="server">
<asp:TableRow>
<asp:TableCell>
Fields1:
</asp:TableCell>
<asp:TableCell><asp:TextBox ID="txtFields1" runat="server">
</asp:TextBox>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
<asp:Button ID="Button1" runat="server" Text="Submit" />
<asp:Button ID="btnCancel3" runat="server" Text="Cancel" />
</asp:Panel>
<asp:Button ID="LinkButton1" runat="server" Text="Link Button" />
I also put this at the top of Site.Master
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
The error I am getting is this:
http://i.stack.imgur.com/4gCvF.png
If I click to ignore the error, this is what happens
http://i.stack.imgur.com/D0f1k.png
OkControlID="OkButton"
should match the submit button
<asp:Button ID="Button1" runat="server" Text="Submit" />
To close the modal window. You currently don't have a button with the ID "OkButton"
EDIT:
Also, you want to use
<asp:ToolkitScriptManager ID="ScriptManager1" runat="server" > </asp:ToolkitScriptManager>
instead of
<asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager>
(or in your case I think you want to use <act:ToolkitScriptManager... but I'm not a pro so play with it)
Note: I figured this out a few days ago, and I had to add the attribute CombineScripts="false" to the ToolkitScriptManager to get it to work, but I think this depends on your environment and what other javascript files you have running
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:ImageButton ID="imgCal" runat="server" ImageUrl="~/Images/calender.png"/>
<asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="TextBox2" PopupButtonID="imgCal" >
</asp:CalendarExtender>
</div>
</form>
the same code works on different machine, but mot in mines,
any code for this is appreciated..
thanks in advance for any suggestion..
Your code works fine in my machine. Just remove ajax control dll and add latest ajaxcontrol toolkit to your project.
Replace ScriptManager with ToolkitScriptManager.
I am trying to set up ajaxConfirmButton Extender. Here is my code
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<script language="javascript" type="text/javascript">
function onCancel()
{
var lblMsg = $get('<%=lblMessage.ClientID%>');
lblMsg.innerHTML = "You clicked the <b>Cancel</b> button of AJAX confirm.";
}
</script>
<asp:Label ID="Label1" runat="server" Text="Click this button to open AJAX Confirm box:" Font-Bold="true" Font-Size="16px"></asp:Label><br />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Button ID="btnConfirm" runat="server" Text="Confirm" OnClick="btnConfirm_Click" />
<ajaxToolkit:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID="btnConfirm"
ConfirmText="Are you sure?
You want to run the server code." OnClientCancel="onCancel" ConfirmOnFormSubmit="false">
</ajaxToolkit:ConfirmButtonExtender>
<asp:Label ID="lblMessage" runat="server"></asp:Label><br />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
code behind
protected void btnConfirm_Click(object sender, EventArgs e)
{
lblMessage.Text = "You clicked the <b>OK</b> button of AJAX confirm";
}
But the confirm wondow is not coming. It is just performing the onclick action. Need help to fix this problem
You need to use ToolkitScriptManager instead of ScriptManager.
<ajaxToolkit:ToolkitScriptManager ID="ToolKitScriptManager1" runat="server">
</ajaxToolkit:ToolkitScriptManager>
Hope it will help you
I have a web site developed on VS2005. that compiles fine.
But when i try to publish it whit the "Allow this web site to be updatable" i get the following compiller error:
error BC30002: The type 'ASP.ucDireccion' is not defined.
The problem seams to be related to a user control im accesing its public properties and methods.
I have the user control on the page and have also put the <#register> directive on the page.
here is the relevant code where te compiler indicates the errors
- Private Sub CargarDireccionAControl(ByVal ctrlDireccion As ASP.ucDireccion)
- Dim ctrl As ASP.ucDireccion = CType(Me.pnl_AdicionarSolicitudes.FindControl(id_Control), ASP.ucDireccion)
and several others
Here are the relevant parts of the ASPX page:
<%# Page EnableEventValidation="false" Language="VB" MasterPageFile="~/Principal.master"
AutoEventWireup="false" CodeFile="AV_SolicitudVerificacion.aspx.vb" Inherits="Verificaciones_AV_SolicitudVerificacion"
Title="Untitled Page" %>
<%# Register Src="wucMapa.ascx" TagName="wucMapa" TagPrefix="uc2" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%# Register Src="../UserControls/ucDireccion.ascx" TagName="ucDireccion" TagPrefix="uc1" %>
<%# Reference Control="../UserControls/ucDireccion.ascx" %>
<%# MasterType VirtualPath="~/Principal.master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<ContentTemplate>
<asp:UpdatePanel ID="up_Solicitudes" runat="server">
<ContentTemplate>
...
...
...
<cc1:CollapsiblePanelExtender ID="cpeMapa" runat="server" Collapsed="True" TargetControlID="pnl_mapa">
</cc1:CollapsiblePanelExtender>
<asp:Panel ID="pnl_mapa" runat="server" BorderColor="WhiteSmoke" ForeColor="Black" BackColor="White" BorderStyle="Solid" HorizontalAlign="Center">
<uc2:wucMapa ID="wucMapa1" runat="Server" />
<asp:Button ID="bt_CancelarMapa" CssClass= "boton_azul" runat="server" CausesValidation="False" Text="Cancelar" OnClick="cancelarSolicitud"/></asp:Panel>
<uc1:ucDireccion ID="ucSolicitudDomicilio1" runat="server" TipoSolicitud="Domicilio"
Visible="false" />
<uc1:ucDireccion ID="UcSolicitudTrabajo1" runat="server" TipoSolicitud="Trabajo"
Visible="false" />
<uc1:ucDireccion ID="UcSolicitudTrabajo2" runat="server" TipoSolicitud="Trabajo"
Visible="false" />
<uc1:ucDireccion ID="UcSolicitudTrabajo3" runat="server" TipoSolicitud="Trabajo"
Visible="false" />
<uc1:ucDireccion ID="UcSolicitudTrabajo4" runat="server" TipoSolicitud="Trabajo"
Visible="false" />
<uc1:ucDireccion ID="UcSolicitudTrabajo5" runat="server" TipoSolicitud="Trabajo"
Visible="false" />
</ContentTemplate>
</asp:UpdatePanel>
...
...
the user control relevant parts
<%# Control className="ucDireccion" Language="VB" AutoEventWireup="false" CodeFile="ucDireccion.ascx.vb" Inherits="ucDireccion" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
...
...
You should note that when i unchek the "Allow this web site to be updatable" option of the publish dialag. it works fine.
Thanks very much for your time
Regards Hugo
Why is this line:
<%# Reference Control="../UserControls/ucDireccion.ascx" %>
surrounded with **?
What happens when it's included first thing in the page or just after the #Page directive? I'd say that putting it may solve the problem.
Also check this post if you haven't already:
http://rbgupta.blogspot.com/2007/06/turning-ascx-user-control-into.html