Solved

ASP.NET  How to hide a button from view

Posted on 2014-03-28
8
581 Views
Last Modified: 2014-03-28
Hi.. I have hidden button that I click using JS.
The button appears to the user. I can't seem to hide it from the page.
Any ideas?
thx

     <asp:Button ID="HiddenButton" Text="" Style="display: none;"  OnClick="btnHidden_Click" runat="server" BackColor="Transparent" Width="0px" />
0
Comment
Question by:JElster
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 29

Expert Comment

by:becraig
ID: 39962166
Try this:

     <asp:Button ID="HiddenButton" Text="" Style="display: none;background: transparent; border: none !important; font-size:0;"  OnClick="btnHidden_Click" runat="server"  />
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 39962172
The "display:none;" part should work fine. Maybe you have another style, or some script, that is overriding it.
0
 
LVL 1

Author Comment

by:JElster
ID: 39962602
Still shows a thin line?
0
 
LVL 26

Expert Comment

by:Alan Warren
ID: 39962732
Hi JElster,
Had a similar issue recently with a textbox, that I wanted to populate with a minimum date value, for a compare validator, couldn't set visible="false" or Ajax couldn't find the ControlToCompare hmmm, ended up bludgeoning it into submission like this:
<asp:TextBox ID="MinPickupDateTextBox" runat="server" Text='<%#Eval("minPickupDate")%>'  width="0px" Height="0px" BorderStyle="None" BackColor="Transparent" BorderColor="Transparent"/>

Open in new window

Respectfully yours,
Alan
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 29

Assisted Solution

by:becraig
becraig earned 200 total points
ID: 39962755
<asp:Button ID="HiddenButton" Text="" Style="display: none;background: transparent; border: none !important; font-size:0;border:0px"  OnClick="btnHidden_Click" runat="server"  />
0
 
LVL 1

Author Comment

by:JElster
ID: 39962785
Both show small boxes??????????????
0
 
LVL 29

Expert Comment

by:becraig
ID: 39962808
I am guessing
<asp:Button ID="HiddenButton" Text=""  Visible="false"  OnClick="btnHidden_Click" runat="server"  />


will not do what you need  ?
0
 
LVL 26

Accepted Solution

by:
Alan Warren earned 300 total points
ID: 39962963
Hi JElster,

Try isolating the issue, create a new page, one that doesn't inherit a masterpage or any site themes or styles, paste the samples provided and see if the issue persists. If successful, try loading your previous page in another browser, one that hasn't cached your existing pages, it may be a cache issue. If still no joy, I'd suspect some CSS in the site.css that is appyling style to input { } elements, possibly box-shadow, or outline or some such thing.

Respecfully yours,
Alan
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now