How to give link to an image in .cs page? - asp.net

I have a table. In that i have an image and a label. I have to give hyperlink to both of them. I have given hyperlink to label as same i have to give it to the image from the aspx.cs page. Can anyone tell me how to give it???
Plz..
Thnx in advance.

It's not clear from the question what you are trying to do?
DO you want to just have both the image and the label be clickable, and go to the same url?
You can wrap them in an anchor like so:
<a href="[Your url]">
<asp:Label runat="server" Text="Label Text">
</asp:Label>
<img />
</a>

Related

Asp.net Textbox displayed side by side

Hello guys I just started designing form with asp.net tags and would like to achieve what's on the image exactly. Thanks guy
If i understand you right, this is the code you need:
<asp:TextBox runat="server"></asp:TextBox><asp:TextBox runat="server"></asp:TextBox>
and the result:
Add some styles to make it pretty.
Blockquote
Here is the code with labels (you can also use asp labels):
<div style="display: inline-grid">
<asp:TextBox runat="server"></asp:TextBox><label>textbox1</label>
</div>
<div style="display: inline-grid">
<asp:TextBox runat="server"></asp:TextBox><label>textbox2</label>
</div>
and the result:
You can also put the style in the css.

Watermark for an ASP.Net Panel

Does an asp.net panel can be inserted with a watermark? These panel is used for printing purposes. Another problem is that the background image in the panel is not printing, only the objects inside of it.
I think you should take a look at BackImageUrl property. And assign the path of the watermark image to it.
<asp:Panel BackImageUrl="yourimagefile.png" />
Also, the image should be given a proper opacity / alpha value so that it's transparent.
Here is one more example http://www.codeproject.com/KB/web-image/ASPImaging1.aspx from codeproject that you can do many thinks on the image, including adding watermark from image.
<asp:Panel ID="Panel1" runat="server">
<asp:Image ID="Image1" runat="server" ImageUrl="~/yourimage.png" />
<div style="margin-top: -xxx"><--change the position <div> to overlaps with the image
....
your content here
....
</div>
</asp:Panel>

How to display text in front and use a image in back ground?

I want to create a div which has background image and want to display some text on it. I have tried my self but i dont know why its not work for me. My code is as below:
<div style="background-image: image/test.jpg">
<asp:label id="test" runat="server" text="hello" />
</div>
Please let me know where i am wrong.
See https://developer.mozilla.org/en/CSS/background-image. The address should be wrapped in url():
style="background-image: url(image/test.jpg)"
Also of interest might be the background property which allows more control over placement, repetition and fill color.
The style is slightly wrong, it should be:
style="background-image: url('image/test.jpg');"

ASP.NET "To Bottom" hyperlink

On an aspx page I have following hyperlink:
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="#Bottom" CssClass="ToBottom">To Bottom ↓</asp:HyperLink>
I would like to use it to navigate to the bottom of the page, more specificly, to an anchor with the name "Bottom":
<anchor name="Bottom" />
This doesn't work however... Any suggestions on how to make "To Bottom" and "To Upper" hyperlinks to quickly scroll through the page? Thanks.
**UPDATE:
A regular
To Bottom ↓
Doesn't work either.
This ought to do the trick:
To Bottom ↓
<a name="Bottom" />
I'd recommend using a regular anchor elment for this, there's no use for a server control:
To Bottom
This will work (using href property):
<asp:HyperLink href="#Bottom" runat="server" CssClass="ToBottom">To Bottom</asp:HyperLink>
and building an anchor like:
<a name="Bottom"></a>

ASP.NET LinkButton Tooltip gets overriden by image alternate text

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.
<asp:LinkButton CssClass="button button-input" ID="btnSearch" runat="server" CausesValidation="False" ToolTip="Search">
<img id="imgSearch" runat="server" src="../../../images/icons/magnifier-left.png" alt="search-something" width="12" height="12" />
</asp:LinkButton>
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.
This is the produced XHTML:
<img width="12" height="12" alt="search-something" id="..." src="../../images/icons/magnifier-left.png">
Is it possible to overcome this issue?
Removing all alternate texts will resolve the issue but a better (more standard) way is always welcome!
Try to set a empty title attribute on your image.
Or use <asp:ImageButton /> instead of the <asp:LinkButton />

Resources