.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Target Audiences on the Master Page

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :C#


Hi Guys,


I've used target audeinces a lot around SharePoint on general web parts without any issues...it's a great feature. 


Has anyone tried using target audiencing on web parts built into the master page?  SharePoint Designer gives you the option to add an audience but it never seems to work.


Has anyone got this working before?





View Complete Post

More Related Resource Links

Unique content within master page based on conditions met


 Hi all-

I would like to present users with unique content based on certain conditions being met as they land on the home page (default.aspx).  The condition logic will be in the VB code behind Page Load event. The content will go in a content placeholder as specificed from the master page. 

However, the content change wouldn't be something small (ie making a panel or label visible or not) but rather it will be different HTML,  Divs and databound gridview content.  The HTML content will be stored in the database.

Can someone point me in the right direction for best practices on how to accomplish this?


Passing Linq Statement between master and content page


I usually work with windows forms, and am just starting to work with ASP.Net, so appologies if this is a dumb question!

I have a master page which has a search button on it. The results of this are built up using a Linq statement and if there are any results, I want to display the results in a contents page.

On the masterpage, I have the following code:

Private _res

    Public Overridable ReadOnly Property SearchRes()
            Return _res
        End Get
    End Property

 Private Sub DoSearch()
   'some code to get a linq result

    If res.Any Then
            _res = res
            Server.Transfer("SearchResults.aspx", True)
            'no results
            LabelNoRes.Visible = True
        End If
 End Sub

On the SearchResults.aspx page I have this code.

Dim m As pxSite = CType(Page.Master, MasterPage)
        If m.SearchRes IsNot Nothing Then
            Label1.Text = "Results found = " & m.SearchRes.Count
        End If

m.searchRes is always nothing. 

What am I doing wrong here?


Re-positioning an HTML container with javascript onresize with a Master page.


I have an HTML <div> container that I float to the right of a gridview.  When the browser window is maximized, it looks fine.  When minimized, the gridview positions below the floating container and most of the data is pushed off the bottom of the browser - you have to scroll down to see it.

If I position the floating container above the gridview it looks fine in a minimized window, but looks real bad when maximized.

What I want to do is use a javascript: onresize event to re-position the floating container up or down depending on the window.inner.width AND do it with a Master/Content page structure AND do it for only the one page where needed.

I can capture the onresize event and display the window dimensions but haven't figured-out how to do it with a Content page that still uses the Master page.  I think I'm having a very "thick" week...

- Tinker


Not getting multiple composite controls on master page


I have created two composite controls in the same assembly and registered that assembly in a master page using <%@ Register tag.

When I try to use these controls using the registered tag prefix I am getting only one control along with the tagprefix .

How to get all the composite controls present in the registered assembly?

Master Pages: Master Your Site Design with Visual Inheritance and Page Templates


Master pages in ASP.NET 2.0 solve a problem many Web developers have been solving on their own with a variety of techniques for years - providing a single master template for an entire site. This article covers the details of master pages, discussing their usage and implementation and how they are a natural evolution of custom techniques developers are using today.

Fritz Onion

MSDN Magazine June 2004

Dynamic Checkboxlist exception when adding to Panel when using Master Page


In essence, I am creating Dynamic Checkboxlist controls and adding them to a Panel.  It works well when I do not have a Master Page configure to this webpage. Once I have a masterpage congifured.. I get a "Object Reference not set to instance of object" error on the Panel_Control.Controls.Add(Checkboxlistnew) line:

protected void Page_PreInit(object sender, EventArgs e)
        XML OXML = new XML();
        alistChkBoxLabels = OXML.XMLTransform("C:\\Documents and Settings\..\\Config_new.xml", "config_options/check_box/applications/app/@name");
        int count = 1;
        alistCheckisFacility = new ArrayList();
        alIDTracker = new ArrayList();
        while (count <= alistChkBoxLabels.Count)

            Checkboxlistnew = new CheckBoxList();
            Checkboxlistnew.ID = count.ToString();
            Checkboxlistnew.Items.Add(new ListItem(alistChkBoxLabels[count - 1].ToString(), alistChkBoxLabels[count - 1].ToString()));

            String sAppName = alistChkBoxLabels[count - 1].ToString().Trim();

            alistCheckisFacility = OXML.XMLTransform("C:\\Documents and Settings\\Administrator\\My Documents\\Visual Studio 2005\\WebSites\\User_Trial\\Config_new

Button click in master page use in other pages I have to click twice. Why?


In my masterpage I have a menu with buttons. I want the buttons to do something after click. It works but I have to click twice on the button, why? What do I have to do to just to click once?

Is master page a best alternative for Frame Sets ??


My webpage has one banner with a logo, a vertical menu bar on the left side of the page and a footer . I have 5 other pages which should get loaded when the user select them from the menu bar. what my concern is actually the banner,  menu bar  and the footer should not change when the requested page loads. This definitely can be handled by sets. But I want to know whether there are any other alternatives for frame sets or could master page be helpful for this purpose ????? 

Any help would be appreciative .

DropDownMenu disapper in master page


Dear all,


I have master page and wen i use master page my drop down menu selection disapper in web forms...could anyone pls help me...am not so clear about z-index...








@ Master Language="VB" AutoEventWireup="false" CodeBehind="Default.master.vb" Inherits="E_Management._Default1" %>

Apply custom.master to "Site Settings" page?


I'm using a custom.master page, which is applied to almost all pages available to READ users.

However, I'd like to apply it to the Search, Site Settings, and View All Site Content pages.

I'm not sure where this would be applied.

Guidance much appreciated. Thanks!

Sharepoint 2007 - Wiki site - New Pages Not Inheriting Custom Master Page


I am working on a SP site (MOSS not WSS) which is heavily customised away from the OOTB layout. I need to create a Wiki site, which was going well - I've created a master page which displays the miniconsole (this was not visible with our customised layout), and made it the default master page for the site. This has been applied to the two standard pages that come with the Wiki site, however when a new page is created, it seems to inherit the default.master, rather than my custom master page - thus not showing the miniconsole.

When I have created a new page, I am able to use SharePoint Designer to attach my custom master page to it, which works perfectly, however this will not be a viable option going forward as end-users create their new wiki pages.

How can I get the new pages to inherit my master page when they are created?


Target Audiences not working


Microsoft Office SharePoint Server Enterprise 2007 Version:

I created a Target Audiences for a Security Group that I created for a Pilot program that is being kicked off.  I only want the Security Group to see it.  I logged onto the site as a member OUTSIDE of the Security Group and I still saw it.  I have the example below, with the security group from Active Directory.  Any reason why it would not work?

Below is an Announcement on our Corporate Intranet site for educating users on Information Technology and computer related items.  It is a portal that we would like them to go to, to get all of their information.  I have yet to break up items based on Target Audiences, but now I think it might be a great time, as I have a way to use it that will be around for a few weeks.

Title Test  
Body Test
Expires 8/25/2010  
Target Audiences Security Pilot Group


Thank you.


Master Page manipulation


I've never worked with ASP.net before this project, and I am struggling a bit.  The website I am updating was written in ASP.net and C#, using a master page.  The master page is simple enough (header section, maincontent section, footer section, and a righcontent section).

What I need to happen...

On one page only, I would like the maincontent section to extend through the rightcontent section.  On this page I will not need the rightcontent section.

What is the easiest way to produce these results?  As of now, I have unused space on the page...and I can't figure out how to utilize the extra white space.  

Please advise.

Use of Master Page



can anyone tell me use of Master Page in ASP.Net


Pratik Asthana

Problem with master page and update panel (I think)



the app I am working with is made up of three nested master pages that have the following design:

The first master page ha only realize the HEADER, BODY and FOOTER divs.

The second one specialize the Body content placeholder and divide it in three more layers: NAVIGATOR, PAGE TITLE, BODY CONTENT.

The final layer specialize the BODY CONTENT in PAGE CONTENT and ACTIONS.

In one of my content pages I have (inside the PAGE CONTENT area) 

  • 1 Update Panel that contains a gridview object
  • 1 Update Panel that contains some HTML code to show in a PopupModalExtender

The PopupModalExtender can be either triggered from inside the gridView and also from a series of LinkButtons that are in the ACTIONS area.

The problem is that when the PopupModalExtender shows the FOOTER and the ACTIONS areas are not dimmed from the style I apply as background to the modal popup. An example of what I am trying to explain can be viewed in the following screenshot.

Why this is going to happen? Has anybody any suggestion on how to solve this problem?

Thanks a lot

Mysite Default Master Page



We have been using the mysite section of sharepoint for 6 months and have recently changed the default.master is there any quick way of changing all the users pages without losing anydata.

I know i can go into the Master Page library for the users, upload the new default.master and then set this as default within sharepoint designer, however this will be quite a lenghty task for me to complete for all our userbase.

Could you please advise if there is a quicker way to do this.

Programmatically Hide Master Pages from Site Master Page Settings page?



I know there is a field you can check when you edit the properties of a Master Page in the Master Page Gallery to set a Master Page to hidden but ... can anyone think of a way to programmatically hide specific Master Pages from the Site Master Page Settings page?

Maybe this should be two questions:

  1. How do I programmatically access a Master Page in a Master Page Gallery?
  2. Is there a property that can be set that will hide the page from the Site Master Page Settings page?

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend