Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm having a HTML button in master Page.
I've to keep it in some other pages and want to hide in a particular content Page.
How can I do that?
here is my button code in source file


XML
<button onclick="openPartyWin(); return false;">
                                                            Find Party
                                                        </button>
Posted

<%= (Request.RawUrl.ToLower("PageNotToShowOn.aspx") ? "" : "<button onclick=\"openPartyWin(); return false;\">") %>
 
Share this answer
 
v2
Comments
durgeshtupkar10 3-Jun-11 7:36am    
where to add this code?
DominicZA 3-Jun-11 7:39am    
this code will replace your current code in the aspx page!
durgeshtupkar10 4-Jun-11 2:05am    
I have a html button in Master Page,I want to hide the button in content page

<button önclick="openPartyWin(); return false;">
Find Party
</button>.

and I'm using .ini files to invisible the controls, for that I need ID of the control,
e.g. to hide any asp textbox i write in .ini as textbox1=true
where textbox1 is ID of te textbox
but here I cant find the ID of the html control.
And one thing I must have to use html button, not anyother
durgeshtupkar10 4-Jun-11 9:13am    
plz reply ASAP
durgeshtupkar10 6-Jun-11 1:36am    
Reply plz.......
Try Following :

First create your button as server control (e.g. runat="server")

use following code to find and hide master page button.

Dim btn As HtmlInPut = Me.Form.Parent.FindControl("btnInsert")
btn.visible = false
 
Share this answer
 
Try this,

In master page,
MasterButton


In aspx.cs page,

protected void Page_PreInit(object sender, EventArgs e)
{
HtmlButton btn = (HtmlButton)Master.FindControl("btnToHide");
btn.Visible = false;
}

..............
@Nidhish
 
Share this answer
 
Comments
ramamadhavi 2-Aug-12 6:32am    
This do not work for me. i am using the same on vb.net code. getting NullReference Exception.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900