The title displays properly in all other search engines, it only does this with Google's search:
The site (www.ClearspanInc.com) has been up for awhile, and has had more than enough time to be crawled. We are using ASP.net.
<!DOCTYPE html>
<html lang="en">
<head id="Head1" runat="server">
<meta charset="utf-8" />
<title>******* - <%: Page.Title %></title>
<asp:PlaceHolder ID="PlaceHolder1" runat="server">
<%: Scripts.Render("~/bundles/modernizr") %>
</asp:PlaceHolder>
<head>
<title>My Title</title>
</head>
Try this inside the #Page:
<%# Page Title="Home Page" %>
Or inside the Page_PreRender you can add Page.Title = "";
Related
net site with master and child pages. I am generating title via .cs code file on each child page. It works fine on the desktop. However, when I try to browse via mobile, it throws the above error. Below is code for master page.
<%# Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="xyz.SiteMaster" %>
<!DOCTYPE html>
<html lang="en">
<head runat="server">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="css/styles.css" type="text/css" >
</head>
<body>
<form runat="server">
<asp:ContentPlaceHolder ID="MainContent" runat="server">
</asp:ContentPlaceHolder>
</form>
</body>
</html>
****child page code behind ***
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
HtmlTitle title = new HtmlTitle();
title.Text = "child page title";
Header.Controls.Add(title);
}
}
*** child page ****
<%# Page Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="childpage.aspx.cs" Inherits="xyz._Default" %>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
</asp:Content>
what is the best way to handle this. Appreciate your thoughts on this.
Can someone help me with my test environment for calling Javascript function through external file in DevExpress?
In my root.aspx, I included my external Javascript as you may see below:
<%# Master Language="C#" AutoEventWireup="true" CodeBehind="Root.master.cs" Inherits="TestProjects.RootMaster" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, user-scalable=no, maximum-scale=1.0, minimum-scale=1.0" />
<title></title>
<link rel="stylesheet" type="text/css" href="Content/Site.css" />
<script type="text/javascript" src="Script/TestJS.js" id="dxss_SOMECODE"> </script>
</head>
And in my content page I have this code:
<%# Page Title="" Language="C#" MasterPageFile="~/Light.master" AutoEventWireup="true" CodeBehind="testPage.aspx.cs" Inherits="TestProjects.WebForm1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<p>
</p>
<dx:ASPxFormLayout ID="ASPxFormLayout1" runat="server">
<Items>
<dx:LayoutItem>
<LayoutItemNestedControlCollection>
<dx:LayoutItemNestedControlContainer runat="server">
<dx:ASPxTextBox ID="ASPxFormLayout1_E1" runat="server">
<ClientSideEvents TextChanged="jsAlert()" />
</dx:ASPxTextBox>
</dx:LayoutItemNestedControlContainer>
</LayoutItemNestedControlCollection>
</dx:LayoutItem>
</Items>
</dx:ASPxFormLayout>
</asp:Content>
And in my Javascript file I have this code:
function jsAlert(s,e)
{
alert("just a test");
}
My problem occurs when I run the page, it displayed the alert even though I didn't put any changes in the textbox, but when I do put some changes it would display error. Can anyone tell me what's wrong with my coding?
Thanks.
Can you try this;
<ClientSideEvents TextChanged="function(s, e) { alert('just a test'); }" />
Or;
<ClientSideEvents TextChanged="function(s, e) { jsAlert(s,e); }" />
I am trying to get get model in aspx page. How can i get it. is anything i have to do in config file? PLease help me.
<%# Page Language="C#" AutoEventWireup="false" CodeBehind="Report.aspx.cs"
Inherits="IBATechnologies.IBA.Main.Views.Report" %>
<%# page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script runat="server">
Model // here i cant find Model "the name Model is not in current
context"
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
i'm not sure but you can use DynamicViewPage instead ViewPage.
may be this link will help you.
https://learn.microsoft.com/en-us/aspnet/mvc/overview/views/dynamic-v-strongly-typed-views
I don't understand the scope of the variables in my .Master pages - can anyone assist?
In the example below settings cannot be seen in either usage following its instantiation:
<%# Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>
<% var settings = new SettingRepository(); %>
<!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">
<meta name="description" content="<%: settings.metaDescription %>"/>
<title>
<asp:ContentPlaceHolder ID="TitleContent" runat="server" /> - <%: settings.pageTitle %>
</title>
...
In the example below settings can only be seen in the FIRST usage, but not the second:
<%# Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>
<!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">
<% var settings = new SettingRepository(); %>
<meta name="description" content="<%: settings.metaDescription %>"/>
<title>
<asp:ContentPlaceHolder ID="TitleContent" runat="server" /> - <%: settings.pageTitle %>
</title>
...
According to me what ever variable you use in Master page it is accessible to its XAML file and cs file.
You can access it in its content pages like this:
String variable=((MasterPageName).this.Master).variable;
Use #MasterType directive, as explained here:
http://msdn.microsoft.com/en-us/library/c8y19k6h.aspx
I've an aspx page that extends a master page. I want to change aspx page's document mode. I'd like to put this line to aspx page. But It doesn't allow. I don't want to put this code to master page's head want only change the page's document mode. Can somebody help me?
<meta http-equiv="X-UA-Compatible" content="IE=9" />
You need a placeholder in your masterpage:
<head>
<asp:ContentPlaceHolder id="plhHead" runat="server"/>
</head>
If your <html/> tag has no runat="server", you need to apply it to the <head/> tag like KPL did.
And then fill it in the client page like you do with your main content placeholder:
<asp:Content ContentPlaceHolderId="plhHead" runat="server">
<meta http-equiv="X-UA-Compatible" content="IE=9" />
</asp:Content>
Place a ContentPlaceHolder in the head section of your Master Page:
<head runat="server">
<asp:ContentPlaceHolder ID="HeadContent" runat="server">
</asp:ContentPlaceHolder>
</head>
Now from your .aspx page, you can add custom content in the head section:
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
<meta http-equiv="X-UA-Compatible" content="IE=9" />
</asp:Content>
As an alternative to placing a ContentPlaceHolder in the Master page, you can do this:
// Programmatically add a <meta> element to the Header
HtmlMeta keywords = new HtmlMeta();
keywords.Name = "X-UA-Compatible";
keywords.Content = "IE=9";
Page.Header.Controls.Add(keywords);