Using a Master Page - Display a Search Box on all pages

I’m using a master page to add a search box to the navigation bar on all my pages, but I also have a dedicated search page that has it’s own search box. I would like the navigation search box to show up on every page except the dedicated search page. What’s the best way to accomplish this?

I’m presently including the navigation search box like so:

<form id="Form1" runat="server">

      (other page stuff)

	    <div id="menu">
		

                       (Other menu Stuff)		
		
	            <asp:Panel ID="sSearchBox" runat="server" DefaultButton="sButton" CssClass="searchBox">
                        <asp:Label ID="sLabel" runat="server" Text="Label" CssClass="sLabel">Search</asp:Label>
                        <asp:TextBox ID="sText" CssClass="sText" runat="server" ></asp:TextBox>
                        <asp:Button ID="sButton" runat="server"  EnableTheming="True" ToolTip="Search"
                        PostBackUrl="~/search.aspx" CssClass="sButton" />
	            </asp:Panel>
		
	    </div> <!-- End Menu -->
</form>

In the master page you would have something like this:
[HIGHLIGHT=ASP.NET]
<form id=“Form1” runat=“server”>

  (other page stuff)

    &lt;div id="menu"&gt;
	

                   (Other menu Stuff)		

<asp:contentplaceholder id=“SearchBoxLayout” runat=“server”>
<asp:Panel ID=“sSearchBox” runat=“server” DefaultButton=“sButton” CssClass=“searchBox”>
<asp:Label ID=“sLabel” runat=“server” Text=“Label” CssClass=“sLabel”>Search</asp:Label>
<asp:TextBox ID=“sText” CssClass=“sText” runat=“server” ></asp:TextBox>
<asp:Button ID=“sButton” runat=“server” EnableTheming=“True” ToolTip=“Search”
PostBackUrl=“~/search.aspx” CssClass=“sButton” />
</asp:Panel></asp:contentplaceholder>

    &lt;/div&gt; &lt;!-- End Menu --&gt;

</form>



On normal pages you'll just leave <asp:Content ID="MenuLayout" ContentPlaceHolderID="SearchBoxLayout" runat="server"> out but on the dedicated search page replace it with:
[HIGHLIGHT=ASP.NET]<asp:contentplaceholder id="SearchBoxLayout" runat="server"/>

Alternately, you could put

Panel x = (Panel)Master.FindControl("sSearchBox");
x.Visible = false;

in the Page_Load(object sender, EventArgs e) of search.aspx.cs

Kitty got a better way.
Here is another way of doing it.
on master page code behind check the page name, if its search page hide the search on nav.

if(Request.Url.ToString().ToLower().IndexOf(“/search.aspx”)>0) //considering page name is search.aspx
{
//make search part invisible.
}

I checked the requirement you only need to show navigation search box on every page except the dedicated search page for this in dedicated search page you just need to find the id of searchtextbox on page load event of the dedicated search page and set visible false.

Like i have used for label control like

lblM = (Label)Master.FindControl(“lblMP”);
lblM.Visible = false;

Well, that leaves the panel control in place. Taking my suggestion above prevents the entire panel from rendering.