Solved

ASP.NET  How to hide a button from view

Posted on 2014-03-28
8
603 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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
 
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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
key press alert 2 32
What are the simplest ways to create a Merge Sort? 3 29
Insert Button on a table 16 38
vb.net convert long time to mm:ss 23 13
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

827 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