I have a website project that include a masterpage : when ı tried to add ajax control toolkit EDITOR, I am getting a error like This page is missing a HtmlHead control which is required for the CSS stylesheet link that is being added. Please add <head runat="server" />.
when ı add masterpage ContentPlaceHolder1 a <form runat="server"></form>, there arent any error but I don't want to add each masterpage form element
how can ı solved this problem?
<%# Page Title="" Language="C#" MasterPageFile="~/AdminPanel/Admin.Master" AutoEventWireup="true" CodeBehind="Tadd.aspx.cs" Inherits="Tadd.AdminPanel.Tadd1" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit.HTMLEditor" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></ajaxToolkit:ToolkitScriptManager>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<form runat="server">
<cc1:Editor ID="Editor1" runat="server" />
</form>
</asp:Content>
You should have an head tag in your Master-Page which is run at server:
<head id="page-head" runat="server">
...
</head>
And positioned it in top of your page/html.
Related
I'a currently working on C# aspx.net project, and all of a sudden the pages that should load inside master page are not shown, it's like "hidden", only master page is showing, i didn't do nothing revelant to it, i think.
It's getting me insane because i already loaded a backup that i got, and the same problem occurs. So maybe i did something wrong to my Visual Studio 2019?
Does that ever happened to anyone?
I've tryed to change the Netframework from 4.5 to 4.6 but the problem persists.
if i inspect the page on google devtools, the page's are there, but not showing on the content placehonder.
Example of my master page:
<%# Master Language="C#" AutoEventWireup="false" CodeBehind="Masterpage.Master.cs" Inherits="WORKFLOW_FACTURE.Site1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
....
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<div id="wrapper">
</div>
<div id="page-wrapper">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
<!-- /#page-wrapper -->
</body>
</html>
example of one page that should be loaded whenthe user enter the masterpage:
<%# Page Title="" EnableEventValidation="false" Language="C#" AutoEventWireup="false" MasterPageFile="~/Masterpage.Master" CodeBehind="Indicateurs.aspx.cs" Inherits="WORKFLOW_FACTURE.Indicateurs" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<form runat="server">
....
</form>
<script type="text/javascript">
...
</script>
</asp:Content>
I alredy had that same problem on my asp.net application, where bootstrap classes weren't recognized.
It can happen for two main reasons:
1 - *the links *.css / script .js are being called from the master page at bad order, and because of that, dind't load properly.
2 - Calling bootstrap.css instead of bootstrap.min.css, that happened to me, i think that's because of the load time that can be relevant to the content page.
I need to load pages asynchronously using asp.net C#.
I have a master with Two(2) hyperlink controls and One(1) ContentPlaceHolder.
I do not need page refresh or mute the page refresh to load page Async by clicking the hypelink control given on master page.
Code for Main.Master page, Home.aspx page and the products.aspx is given below.
Main.Master
<%# Master Language="C#" AutoEventWireup="true" CodeBehind="Main.master.cs" Inherits="AsyncPageLoadFromMasterLink.Main" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<div id="navbar">
<asp:HyperLink ID="lnkHome" NavigateUrl="~/home.aspx" runat="server">Home</asp:HyperLink>
<br />
<asp:HyperLink ID="lnkProducts" NavigateUrl="~/products.aspx" runat="server">Products</asp:HyperLink>
</div>
<div id="main">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
home.aspx
<%# Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true" CodeBehind="home.aspx.cs" Inherits="AsyncPageLoadFromMasterLink.home" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<h1>This is Home Page</h1>
</asp:Content>
products.aspx
<%# Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true" CodeBehind="products.aspx.cs" Inherits="AsyncPageLoadFromMasterLink.products" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<h1>This is Products page</h1>
</asp:Content>
Bundle of Thanks in Advance
I bet you need to add the hyperlinks to the update panel and bind the hyperlink's OnClick() event to the update panel's trigger.
I have a masterpage in ASP.NET Web forms. I created a ContentPlaceHolder between the form tags on the master page. Then I added a web form (named Page.aspx) to the project with the aforementioned masterpage. I added a Content control to the Page.aspx. Then I wanted to add a GridView in Content tags on Page.aspx. But it gives me the following warning: " ASP.NET runtime error: Only Content controls are allowed directly in a content page that contains Content controls.". How can I fix problem? Sorry for my English.
You probably need to wrap them in these tags:
<ContentTemplate></ContentTemplate>
Master Page
<%# Master Language="C#" AutoEventWireup="true" CodeFile="Master.master.cs"
Inherits="Master_Page" %>
<!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">
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
<form id="form1" runat="server">
</form>
</html>
Page.aspx
<%# Page Language="C#" MasterPageFile="~/Master.master" AutoEventWireup="true"
CodeFile="Page.aspx.cs" Inherits="Faculty_Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<asp:Panel ID="Panel2" runat="server" Height="449px">
<asp:GridView ID="GridView1" runat="server" >
</asp:GridView>
</asp:Panel>
</asp:Content>
Just make a try out of this,It may help
I want to use nested master page so i create the following master page :
<%# Master Language="C#" AutoEventWireup="true" CodeBehind="test.master.cs" Inherits="DocumentFlowUI.test" MasterPageFile="~/MasterPage2.master" %>
<!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>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
<asp:Button ID="Button1" runat="server" Text="Button" />
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
and i create the following page to use that master page :
<%# Page Title="" Language="C#" MasterPageFile="~/test.Master" AutoEventWireup="true" CodeBehind="WebForm4.aspx.cs" Inherits="DocumentFlowUI.WebForm4" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</asp:Content>
I get the following error :
Content controls have to be top-level controls in a content page or a
nested master page that references a master page
The HTML-code in your nested masterpage must be wrapped with an asp:content-tag with a contentplaceholderid from the "master" masterpage.
Just to demonstrate Erik's point:
Parent masterpage:
<asp:ContentPlaceHolder ID="head" runat="server" />
Child masterpage:
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<asp:ContentPlaceHolder ID="head" runat="server" />
</asp:Content>
Page:
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<!-- content -->
</asp:Content>
I built an internal site for my company with asp.net. I copied the site to the server and tested every page in both firefox and ie and everything looked fine, but i noticed that i forgot to add titles to a couple pages. After adding the titles and copying the updated files to the server, my master page is no longer showing when viewed in ie. All the content is still displayed, but nothing from my master page. Firefox is displaying everything normally. I have tried recopying all the files and restarting the app pool. When i use ie to browse the site from the server everything works fine. Everything works fine when i preview the site locally with vwd2010. I have tried viewing the site from 3 different machines with ie and they all are showing the same thing. Has anyone seen anything like this before?
MasterPage
<%# Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
<!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>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
<link rel="Stylesheet" type="text/css" href="styles/Styles.css" />
</head>
<body>
<form id="form1" runat="server">
<div>
<div class="page">
<div class="header">
<div class="title">
<h1>
register support
</h1>
</div>
<div class="clear hideSkiplink">
<asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal">
<Items>
<asp:MenuItem NavigateUrl="default.aspx" Text="Home"/>
<asp:MenuItem NavigateUrl="howto.aspx" Text="Common Problems"/>
<asp:MenuItem NavigateUrl="search.aspx" Text="Search"/>
<asp:MenuItem NavigateUrl="~/incidents.aspx" Text="Incidents" />
</Items>
</asp:Menu>
</div>
</div>
<div class="main">
<asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server" />
</div>
</div>
<div class="bottomlinks">
[administrators]
</div>
</div>
</form>
</body>
</html>
Content Page:
<%# Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
<div>
<asp:PlaceHolder ID="place1" runat="server" />
<asp:PlaceHolder ID="place2" runat="server" />
</div>
</asp:Content>
I am working with master pages and I would like to see what the top of your .aspx web page looks like.. for example it should look something like this
<%# Page Title="Student Registration" Language="C#" MasterPageFile="~/Site.Master"
AutoEventWireup="true" CodeBehind="StudentInfo.aspx.cs" Inherits="MRC_IDSWeb.Pages.StudentInfo" MaintainScrollPositionOnPostback="true" %>
Set the Page Title in the page Header Separately.. not in the html like you would in a .aspx page that does not utilize MasterPages hope this makes sense to you