Hyperlinks Instead Of LinkButton - How To Avoid Border Around Image
Oct 1, 2010
I have an ASP.NET web site which contains some ImageButton controls that cause postbacks used to filter a list of products to certain groups of products.
Now I am moving to ASP.NET 4.0 with SEO-friendly paths like /products/category/item, and I'm using routing with Webforms to map URL's to webforms. In the process, I want to replace my image buttons with hyperlink controls showing the image, so that I can associate a navigational URL with each image.
I'm creating my new image hyperlink something like this:
The big problem I'm facing: the ImageButton used to put a border="0" attribute on the <img> tag in HTML to avoid a border around the image. But how can I achieve the same result using the hyper link control?
With the current setup, the border="0" gets stuck onto the <a href="...."> tag - and that's not exactly what I want / need.
Another problem I am having is I have an image at the top right of a page and I want it to be hard against the edge of the page with no border and I am really struggling to get this to happen.
I have put a hoplink inside an image like this. This is a test but when looking at the banner that is shown you can see a gray border along the banner (GIF).
Is it possible to get rid of this gray border that is around the actual banner here ?
i have a gridview that directly bind to a dataset.Hence there is no column in code behind for me to control the boarder color and border style.I try my code in RowDataBound, but it does not take effect.
I have some pretty straightforward HTML code with a few tables to organize various items of text or images. All works fine except that I need to place a vertical border on both the left and right sides of the screen. I am able to do this with a 2x2 pixel image that I stretch out. When the user has their screen maximized, everything looks great. But when the user hits "Restore Down", then the borders stay in place, but the tables get shoved down so that they start below where the borders end, which is off screen. in other words, the relational alignment between the borders and the tables gets all screwed up. Does anybody know how to make this alignment stay consistent on a restore down? I'm pretty much a newbie with html and asp, so speak slowly. If there is a better method to accomplish this, I'm all ears.
I've looked everywhere and googled everything and couldn't find anything good. What I need is a class that is able to draw an image (graphics) with rounded corners (different on each corner is a plus) with a border and gradient fill.
All the examples I find have some flaws (like bad quality, missing functionality etc).
I will use this with a ashx that will draw the image and then show it to the user.
sometimes we need to use the asp image control so we can generate empty alt tags (visual studio 2005 does not render any attributes set to an empty string). I know how to do this and also how to remove the border style that is automatically added
We implemented this 6 months ago, however, only today have I discovered that it does not work when images are created dynamically.The first implementation was for asp images that have been set up within an aspx page:
The above works-no border style is rendered and the imageurl is populated in code.I have other pages where I'm building up sections dynamically using C# code, such as:-
Im getting some images from a webpage at a specified url, i want to get their heights and widths. I'm using something like this:
Stream str = null; HttpWebRequest wReq = (HttpWebRequest)WebRequest.Create(ImageUrl); HttpWebResponse wRes = (HttpWebResponse)(wReq).GetResponse(); str = wRes.GetResponseStream(); var imageOrig = System.Drawing.Image.FromStream(str); int height = imageOrig.Height; int width = imageOrig.Width;
My main concern with this is that that the image file may actually be very large,Is there anything I can do? ie specify to only get images if they are less than 1mb?or is there a better alternative approach to getting the dimension of an image from a webpage?
I have few images on my aspx website and was trying to do a simple link to another page from the image. Noticed that the image control does not let me specify the url, and when i was playing wtih <a href... in source code i run into some issues.
Then i noticed HyperLink control and i used that one. In a property window i see "ImageURL", and "NavigateURL", so i guess that eliminated the need for a "Image" control.
The only problem that i run into with the "hyperlink" control is that once the link is created, the image has a "nasty" red border which i need to remove but i am not sure how to. I set border style to None and it did not work. Then i tried to set border width to 0 and still i have a red border around my image.
How do i remove that annoying red border and is there a better way to do image link with aspx?
i have implemented an image preloader using javascript inside my mvc 2 web app, in order to display an animated "loading" image .gif while sequentially displaying page images.I have also implemented caching using a cache profile for the controller action that displays the specific page ([OutputCache(CacheProfile = "LongCache")]).The problem is that the image preloader javascript is called when caching is applied. I was wondering whether i could, somehow, use the image preloader code only when the page gets refreshed and not when the cached version is rendered.
I have a Link Button in asp.net C# inside it i set an image...........when i click on image its works... But when i click on text it donts work , here is my code
However, if I change the text of the LinkButton in the code-behind, I lose the image.
btnTest.Text = "New book name"
I have tried removing the LinkButton's controls in the code-behind and recreating the image along with changing the text, but it still doesn't work. I get either the image or the text but not both.
btnTest.Controls.Clear() Dim NewImage As New Image With NewImage .Height = Unit.Pixel(8) .ImageUrl = "~/DropDownArrow.png" .Width = Unit.Pixel(10) End With btnTest.Controls.Add(NewImage) btnTest.Text = "New book name"
How can I change the text in the code-behind and still retain the image as well?
If I click this button it is working OK (it will respond with a PFD file so no HTML is sent back to the browser), but if I click another button on the page (which makes a full postback) the LinkButtonPrint will not have the inner content, it will be rendered like this:
<a href="javascript:__doPostBack('ctl00$LinkButtonPrint','')" id="ctl00_LinkButtonPrint" onclick="StartLoadTracking(this, 'Loading...');"></a> If I remove the LinkButtonPrint.Attributes["onclick"] = ... line from Page_Load everything works fine (except my js function is not called, but that is normal).
What am I missing here?
EDIT This is duplicate of asp.net Link button image not visible after postback.
So this might be a fairly specific issue but I figured I'd post it since I spent hours struggling with it before I was able to determine the cause.
<asp:GridView ID="gvAttachments" DataKeyNames="UploadedID" AutoGenerateColumns="false" OnSelectedIndexChanged="gvAttachments_SelectedIndexChanged" runat="server"> <EmptyDataTemplate>There are no attachments associated to this email template.</EmptyDataTemplate> <Columns> <asp:TemplateField ItemStyle-Width="100%"> <ItemTemplate> <asp:LinkButton CommandName="Select" runat="server"><img src="/images/icons/trashcan.png" style="border: none;" /></asp:LinkButton> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView>
In the ItemTemplate of the TemplateField of the GridView I have a LinkButton with an image inside of it. Normally I do this when I have an image with some text next to it but this time, for whatever reason, I just have the image. This causes the UpdatePanel to always do a full postback.
i worked album in my web site that read from folder of photos and desplay photo in image if i click it in datalist of samples of this photosi want use next and previous linkbutton to display photos in image like facebookthis photos in folder
I'm using a lot of LinkButtons in my web application with text and images inside them. All LinkButtons are set with a ToolTip and all images inside the LinkButtons are set with an alternate text.
The problem is that in Internet Explorer the alternate text of the image is shown instead of the ToolTip of the LinkButton. In Firefox this problem doesn't exists, it always show the ToolTip of the LinkButton.
As you can see, nothing special; just colors and beautiful things.
I click on the blue Edit button and it fires the OnClick postback just fine.... in Chrome! But if I do the same in IE8, it just does nothing; doesn't even detect a click.
I removed the tag and kept just the word "Edit", and it works just fine in IE8 as a simple underlined link; the postback fires.
So, Why can't IE8 accept anything within LinkButton?