I am using following code to create web part pages. I want to add the "title" of the page as well. I am not sure what would be the extra piece of code. My site is not a publishing site and I am not creating publishing pages just simple web part pages and adding web parts further through code only.

@"<?xml version=""1.0"" encoding=""UTF-8""?>
        <SetList Scope=""Request""><ListID></SetList>
        <SetVar Name=""ID"">New</SetVar>
        <SetVar Name=""Cmd"">NewWebPage</SetVar>
        <SetVar Name=""Type"">WebPartPage</SetVar>
        <SetVar Name=""WebPartPageTemplate""><Template></SetVar>
        <SetVar Name=""Title""><PageName></SetVar>
        <SetVar Name=""Overwrite"">True</SetVar>

I would think you need to clarify your question as im kind confused at what your asking for? the page title in the webpart or the webpart title in the webpage or add a title on the page from the webpart? you also said Programmatically in c#? or SPD? or as a feature? lol sorry to be a pain :)

but if I have got you right it would be the third option and you said you want it in code only?

protected void Page_Load(object sender, EventArgs e)
    ITitleProvider titleProvider = AxBaseWebPart.GetWebpart(this) as ITitleProvider;

    // Specify the title to pass as the AxPageTitle
    titleProvider.Caption = "Page title goes here";

    // Do not include the context in the title
    titleProvider.ShowContext = false;


  • Ok Let me clarify it more. I am creating web part pages and adding my custom web parts at the same time on feature activation through the code I have listed. By default page name is taken as the Page Title. I am interested in setting the page title (text that appears on browser title bar). And all this should happen on feature activation.Hope it helps. – V.B Aug 17 '12 at 11:38
  • 1
    iv got some links for you to check out. weblogs.asp.net/avnerk/archive/2007/04/11/… and this is hiding the title using css techtrainingnotes.blogspot.co.uk/2009/03/… – Ali Jafer Aug 17 '12 at 12:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.