ASP.NET "To Bottom" hyperlink - asp.net

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>

Related

Add tool tip to Asp Drop-down list

When I add a tool tip attribute to asp drop-down list, its not showing any tool tip,When I include this drop-down in the div tag and give title attribute for the div tag, then i can see the tool-tip.
<div title="Professions">
<asp:Dropdownlist runat="server" ID="ddlProfession" DataValueField="ProfessionName" DataTextField="ProfessionName" Width="260px">
</asp:Dropdownlist>
</div>
But I don't want to add any extra div or any other container. directly i want the drop-down to show the tool tip.even it is fine, if you can guide me how to add title attribute for input tag of asp drop-down list which comes after rendering.
It should work:-
<asp:Dropdownlist runat="server" ID="ddlProfession" DataValueField="ProfessionName"
DataTextField="ProfessionName" Width="260px" ToolTip="Some Text">
</asp:Dropdownlist>
Please note it will render Html select with title attribute as Some Text. So you don't need any extra div.

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 give link to an image in .cs page?

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>

Hide the html contorl from the server side without using attributes runat="Server"

I am using HTML control,and want to visible false from the server side with out using attributes runat="Server"
tell me any solution
Runat="Server" has got nothing to do with visibility.
If you want to hide the control (so that its not visible to any visitors to your site) you would simply set its CSS to visibility:hidden; or display: none;. I think this is what you wanted to know.
Wrap your html controls in an asp:placeholder control, and set the visibility on the placeholder.
Example
<asp:placeholder id="plc" runat="server" visible="false">
<h1>Some Content</h1>
<img src="/images/someimage.gif" alt="" />
</asp:placeholder>

How do I center an image provided as an ASP.NET image control?

The question is pretty straightforward. I have an <asp:Image> which lives in an <asp:Panel>. My goal is to provide a very basic "print preview" where either left, center, or right alignment is selected. The panel represents the full print area (a sheet of 8.5" x 11" paper) and the image inside is the area that will actually get printed. The full code is this:
<asp:Panel ID="Panel2" runat="server"
BackColor="Black"
BorderStyle="Inset"
Width="425px"
Height="550px" >
<asp:Image runat="server" Height="425px" ImageAlign="" />
</asp:Panel>
I set the ImageUrl property in the code behind, no problems there. If I want to align the image all the way to the left or right, I can just specify ImageAlign="[Left|Right]". However, I haven't been able to find a way to center the image in the panel. I've tried all the different ImageAlign values and none of them seem to do what I want. Am I SOL here? If I have to, I can alter the CSS class for the image or panel but I couldn't figure out anything successful with that approach either.
what if you use panel HorizontalAlign="Center" property.......
<asp:Panel runat="server" ID="Panel2" HorizontalAlign="Center">
</asp:Panel>
in your panel tag (which becomes a div client side) just add this attribute:
CssStyle="text-align:center;"
Though that would center EVERYTHING within that panel.
Perhaps just set the CssStyle of the image to a hardcoded left-margin? If your goal is a fixed width print preview, this should be ok.
Panel CSS Property:
CssStyle="alignCenter"
CSS:
.alignCenter
{
margin: 0 auto;
}
you can either use inline style sheet or external style sheet to accomplish this and add your css code in it

Resources