Wednesday, March 12, 2014

Set application page heading dynamically in SharePoint

Introduction

I was had to set the heading of the application page dynamically from the code behind (server side).


Solution

Your application page will look something like this.

 Applicationpage

What you can do is simply replace "My Application Page" with a label and you can replace the text from the back end.

  1. <%-- This is Heading of the page --%>
  2. <asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server" >
  3. <asp:Label runat="server" ID="labelPageTitle"></asp:Label>
  4. </asp:Content>

Now from the code behind you can access the label by its id and set the text as you need.

  1. labelPageTitle.Text = "From code behind";


Conclusion

Your page will look something like this.

apppage

No comments:

Post a Comment