Click here to Skip to main content
15,921,793 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: how to open one datgrid in another datagrid Pin
govindi unal4-May-09 21:12
govindi unal4-May-09 21:12 
AnswerRe: how to open one datgrid in another datagrid Pin
Christian Graus4-May-09 21:15
protectorChristian Graus4-May-09 21:15 
GeneralRe: how to open one datgrid in another datagrid Pin
govindi unal4-May-09 21:31
govindi unal4-May-09 21:31 
GeneralRe: how to open one datgrid in another datagrid Pin
Christian Graus4-May-09 21:55
protectorChristian Graus4-May-09 21:55 
AnswerRe: how to open one datgrid in another datagrid Pin
Nishant Singh4-May-09 23:39
Nishant Singh4-May-09 23:39 
AnswerRe: how to open one datgrid in another datagrid Pin
Uma J5-May-09 0:11
Uma J5-May-09 0:11 
AnswerRe: how to open one datgrid in another datagrid Pin
Anil Chauhan21-May-09 21:36
Anil Chauhan21-May-09 21:36 
QuestionHelp with Headers Please Header.Controls.RemoveAt() Header.Controls.Add Dont Work... Pin
ortaparmak4-May-09 19:45
ortaparmak4-May-09 19:45 
Hello Everyone and thanks in advance for helping me with this.

I need to programmatically locate and change the content of Description and Keyword metatags. Searching the internet, I have found a solution (not a solid one though) but it stopped working after I have changed the order of metatags (which I can understand).

I have a masterpage site.master (with following code beside everything else as usual) where I set a default set of keywords and a default description (which are site-wide):

<head id="Head1" runat="server">
    <title>My Default Page Title Here</title>
    <meta http-equiv="Content-Language" content="tr"/>
    <meta name="Description" content="My Default Description Here" />
    <meta name="Keywords" content="these, are, my default, keywords" />    
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1254"/>
    <meta http-equiv="Cache-Control" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <meta name="Rating" content="General" />
    <meta name="Author" content="Haluk " />
    <meta name="Copyright" content="www.acme.com.tr" />
    <meta name="revisit-after" content="1" />
    <meta name="robots" content="all" />
    <link href="styles.css" rel="stylesheet" type="text/css" />
    <link rel="SHORTCUT ICON" href="favicon.ico" />
</head>


and there are some asp pages (linked with site.master) where I want to be able to change Description and Keywords metatags for obvious SEO reasons. I placed following C# code in respective cs files:

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class akademik_indirim : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        this.Page.Header.Controls.RemoveAt(2);
        this.Page.Header.Controls.RemoveAt(2);
        HtmlMeta child = new HtmlMeta();
        child.Name = "Description";
        child.Content = "Custom Description for This Page";
        base.Master.Page.Header.Controls.Add(child);
        HtmlMeta meta2 = new HtmlMeta();
        meta2.Name = "Keywords";
        meta2.Content = "custom keywords, for, seo, purposes";
        base.Master.Page.Header.Controls.Add(meta2);

    }
}


Now this does not work. All I get is exactly the Description and Title tags I set in asp.net page PLUS SOME OLD KEYWORDS I now can’t find in my project… RemoveAt(2) does not work and additional two metatags I add in cs file are not there (in the resulting html source). This is what I get in browser source window:

<head id="ctl00_Head1">
<title>Akademik Tercüme Çeviri - Tercumex</title>
<meta http-equiv="Content-Language" content="tr" />
<meta http-equiv="Content-Type" content="text/html; charset=windows-1254" />
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<meta name="Rating" content="General" />
<meta name="Author" content="Haluk" />
<meta name="Copyright" content="www.acme.com.tr" />
<meta name="revisit-after" content="1" />
<meta name="robots" content="all" />
<link href="styles.css" rel="stylesheet" type="text/css" />
<link rel="SHORTCUT ICON" href="favicon.ico" /><meta name="Description" content="This is the description I set in asp.net page" />
<meta name="Keywords" content="These are my old keywords which I removed, I searched project wide and they are not in my project anymore, but they appear in result page anyway " />
<style type="text/css">
	.ctl00_NavigationMenu1_Menu1_0 { background-color:white;visibility:hidden;display:none;position:absolute;left:0px;top:0px; }
	.ctl00_NavigationMenu1_Menu1_1 { text-decoration:none; }
	.ctl00_NavigationMenu1_Menu1_2 {  }
	.ctl00_NavigationMenu1_Menu1_3 { border-style:none; }
	.ctl00_NavigationMenu1_Menu1_4 {  }
	.ctl00_NavigationMenu1_Menu1_5 {  }
	.ctl00_NavigationMenu1_Menu1_6 { border-style:none; }
	.ctl00_NavigationMenu1_Menu1_7 {  }
	.ctl00_NavigationMenu1_Menu1_8 {  }
	.ctl00_NavigationMenu1_Menu1_9 { border-style:none; }
	.ctl00_NavigationMenu1_Menu1_10 {  }
	.ctl00_NavigationMenu1_Menu1_11 { border-style:none; }
	.ctl00_NavigationMenu1_Menu1_12 {  }

</style>
</head>


I know that attempting to remove metatags set in site.master by this.Page.Header.Controls.RemoveAt(2) is a sloppy way to do it. But it used to work until a few days ago… And I really can’t seem to get metatags by name. Could anybody hint me to right direction here please?

I want to be able to get metatags Description and Keyword by name and change their content.

Thanks again...
QuestionProblem With window.createpopup() in java script Pin
prabhakar dwivedi4-May-09 19:18
prabhakar dwivedi4-May-09 19:18 
QuestionHow to use the tab controls Pin
cspriya4-May-09 16:13
cspriya4-May-09 16:13 
AnswerRe: How to use the tab controls Pin
Christian Graus4-May-09 17:45
protectorChristian Graus4-May-09 17:45 
AnswerRe: How to use the tab controls Pin
saanj4-May-09 19:28
saanj4-May-09 19:28 
GeneralRe: How to use the tab controls Pin
Abhijit Jana4-May-09 20:27
professionalAbhijit Jana4-May-09 20:27 
AnswerRe: How to use the tab controls Pin
Uma J5-May-09 0:18
Uma J5-May-09 0:18 
Questiontreeview Pin
Malik11224-May-09 14:53
Malik11224-May-09 14:53 
AnswerRe: treeview Pin
Christian Graus4-May-09 15:47
protectorChristian Graus4-May-09 15:47 
AnswerRe: treeview Pin
saanj4-May-09 19:30
saanj4-May-09 19:30 
QuestionEnterprise Library is poo and I hate it. Pin
gantww4-May-09 12:32
gantww4-May-09 12:32 
AnswerRe: Enterprise Library is poo and I hate it - Update Pin
gantww4-May-09 13:16
gantww4-May-09 13:16 
Questionhow add dropdown in infragistic grid Pin
Suhail Ali4-May-09 10:32
Suhail Ali4-May-09 10:32 
AnswerRe: how add dropdown in infragistic grid Pin
Christian Graus4-May-09 17:46
protectorChristian Graus4-May-09 17:46 
QuestionDisplaying 10000 Images from sql srv on load Pin
j1stleger4-May-09 9:59
j1stleger4-May-09 9:59 
AnswerRe: Displaying 10000 Images from sql srv on load Pin
Christian Graus4-May-09 11:38
protectorChristian Graus4-May-09 11:38 
QuestionAudio and Video... Pin
Jamal Abdul Nasir4-May-09 9:05
Jamal Abdul Nasir4-May-09 9:05 
AnswerRe: Audio and Video... Pin
Yusuf4-May-09 9:31
Yusuf4-May-09 9:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.