This project is read-only.

Hide a widget... sometimes?

Topics: Controls, Themes
Oct 13, 2011 at 7:13 AM

Hi guys,

I have some pages in my site where I'm selling stuff and want to hide some of the widgets to cut down on distraction for the prospective buyer. I don't need them losing focus and searching for something, clicking on a tag or a past post, etc.

I'm looking for a way to hide specific widgets on specific pages.

Has anyone done this kind of thing? Or know how to go about it?

I'm fairly code savvy but VB is my thing, not C# and I'm still trying to get my head around BE, so any suggestions are welcome and appreciated.

thanks a bunch,


Oct 13, 2011 at 3:28 PM
Edited Oct 13, 2011 at 3:29 PM

Code behind in the site.master.cs  file is the trick :)


Here is a post about it:

Oct 13, 2011 at 5:33 PM
Edited Oct 13, 2011 at 6:25 PM

Great! Thanks!

It gave me some ideas...

I thought to hide individual widgets I could go directly to the widget and add some code in the widget's ascx file.

Eg. If I want to hide the search box on a particular page then in Widgets/Search/widget.ascx.cs I can do this:

var url = Request.Url.ToString();

            if (url.Contains("default"))

                Visible = false;



                Visible = true;

and I thought that should work, but when it didn't, I realized the URL actually contains the pageid instead like:

So what I'm wondering is where the page name resolution function is in BE? So I can hide/show a widget based off the actual name of the page, and not the id.

Do you know what the method used is to get the page name?