.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

Href and HrefAttribute

Posted By:      Posted Date: September 08, 2010    Points: 0   Category :ASP.Net
What is the difference between @Href and HrefAttribute?

View Complete Post

More Related Resource Links

Javascript funtion in the href property does not accepted


I try to add the following code in a sharepoint 2010 web page

<a href="javascript:function();"> This is a test</a>

but each time I save it, the line disappear. What is wrong with the code??



Issue with in Repeater

Hi -I have the following<%#IIf(IsDBNull(DataBinder.Eval(Container.DataItem, "Website")) OrElse String.IsNullOrEmpty(DataBinder.Eval(Container.DataItem, "Website")), "", DataBinder.Eval(Container.DataItem, "Website") & "<br />")%>I want to add <a href......if the records is not empty.Where do I add that?- Thanks

How to make a connection between a word in the cell (href)? and a rule of the same or another table

 HelloHow to make a connection between a word in the cell (href)? and a rule of the same or another table with sql. Is there also finished editors?

a href in asp:ListItem

I want to have an a href within a  asp:ListItem I tried it the normal way but it's not working.. it's show the ahref code when displaying the asp.net page on the browser what can i do?

setting a href value using javascript and server value from database

Hi Guys,I've been trying to set the href value of an anchor tag using it to do a javascript function, but also want it to have a database value... the whole page is to be called using the jquery .load method which is working fine... just want to get the link to work...here is the code so far for the whole page...<form id="form1" runat="server"> <div id="ajaxeditorspicks"> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:db639_55atcConnectionString %>" SelectCommand="SELECT TOP 3 * FROM [News] WHERE ([EditorsChoice] = @EditorsChoice) ORDER BY [ID] DESC"> <SelectParameters> <asp:Parameter DefaultValue="True" Name="EditorsChoice" Type="Boolean" /> </SelectParameters> </asp:SqlDataSource> <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1"> <ItemTemplate> <li><a href="#"> <asp:Image ID="image1" runat="server" ImageUrl='<%# Bind("imageurl") %>' AlternateText='<%# Bind("Title") %>' />

href - help with opening a pdf

Hi all, I am able to read the textbox value but the pdf will not open for me, I just get a blank IE page. I can open it from IE if I place the location in the address bar or directly point it "href = "location". Here is what I have:  <script type="text/javascript">    function readTextbox() {        var myTextField = document.getElementById('<%= Textbox1.ClientID %>');        if (myTextField.value != "")            alert("You entered: " + myTextField.value)        else            alert("Would you please enter some text?")    }     </script>                                                   <a href="" onclick='readTextbox();' target="_blank">         <img src="images/PDF_icon.jpg" dir="ltr"

Skip link in databinding on an empty image

Hello folks, I have a problem with databinding an <a href> link when there's no image available for the link. My intention is to display a link with <a href=...> when there is an image available and skip the <a href...> if there is no image available but just display the image. i've tried the following but no result:   <%# DataBinder.Eval(Container.DataItem,"adImage") == "noimage.gif" ? <a href='/displayad.aspx?adc=<%# DataBinder.Eval(Container.DataItem,"id")%>' title="(c)" ><img src='DataBinder.Eval(Container,"adImage") /></a> : <img src='DataBinder.Eval(Container,"adImage") />  %s    

Windows 7 window.open() and - target issue



In Windows 7 when I use window.open(url, "_MyWindow") a new browser window opens every time I click.

Expected behaviour is - URL is replaced in the browser window with the same target attribute (_MyWindow) if it's already open.

Any suggestion/workaround is greatly appreciated.

All works fine in any other OS/IE config, even on XP/IE8.




same issue appears using <a href=http://www.microsoft.com target="_MyWindow">Open link</a>

A Href removing space when passing a string in a email

In an email action I'm building a string using an <A href.  I'm working with a list called Document Sets and also a column called Document Set.  I'm passing to a page the current document set in order to filter a web part. 

Here is the example

<A href="http://test.net/sites/r3bs/DocSetPAHO/Site%20Pages/dynamic.aspx?DocumentSet=<%Document Set%>">Click here to review the items.</A>

The problem is that when the document set column data contains a space (such as Company Overview), the email removes the space between Company and Overview (as seen below).  If I add the Document Set column to the email directly it displays fine with the space 

[%Document Sets:Document Set%]


I've tried storing the value to a workflow variable but it still removes the space in the actual email.

how to open a page self after 1 minute breack)(using href or jquery)


i create two page.



i require page1 opend page2 after every one minute

C# Run onlick method in .cs code from href button


I have a css style button that is calling a method in the .cs file

loggut_Click is the method in the .cs file that button is gonna run

From the .... .aspx file

<a class="brochure" href="#" runat="server"><span>Logg ut</span>

have tried changing out the # with onclick="loggut_Click" but its still not working.

from the ....cs file 

protected void loggut_Click(object sender, EventArgs e)
Session["Innlogget"] = "nei";

Any suggestion on how to do this? All this button is gonna do is actually just set the Session "Innlogget" to "nei" as in you are not logged inn anymore. 

Href hover causing page to flicker



I have a link in my page. When the user hovers over the link, the page is flickering.

This is the code I have used

 color: #42C0FB; background: inherit; 
 font: normal 11px auto "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
 line-height: 1.8em;

 color: #6C757A; background: inherit; 
 font: normal 11px auto "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;

<a href="WelcomePage.aspx?UserName=User_nm" id="Welcome" title="Home Page" target="_blank">Welcome to my Page</a>


I am checking in IE 6 and IE 7.
How to avoid the flickering, when user hovers over the link.

Thank you

Regex - changing href urls on the fly...



I have a requirement to alter some href links in a block of text (I'm building a preview function for my CMS), and I'm trying to do it with regex but tying myself in knots.  Here's what I have so far (probably way off base) but its not replacing anything:


public static string previewHref(string html)
        Regex regex = new Regex("href=\"(?<Link>.*?)\"",
            | RegexOptions.CultureInvariant
            | RegexOptions.IgnorePatternWhitespace
            | RegexOptions.Compiled);

        MatchCollection ms = regex.Matches(html);

        string output = html;

        for (int i = 0; i < ms.Count; i++)
            for(int x = 0; x < ms[i].Captures.Count;x++)

someone@yoursite.com --> someone@yoursite.com


Hello all, I have been trying to find a solution to replace all email addresses in a text string to mailto links...

   Public Shared Function ConvertEmailToMailToLinks(ByVal textToconvert As String) As String

        Dim pattern As String = "\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b"

        Dim mailtoemail As New StringBuilder
        mailtoemail.Append("<a href='mailto://")

        Dim input As String = textToconvert
        Dim rgx As New Regex(pattern)
        Dim result As String = rgx.Replace(input, mailtoemail.ToString)

        Return result

    End Function

Microsoft.SharePoint.Publishing.Fields.HtmlField removes href attribute from a tag


I am creating an import tool from an old Web CMS system that exports it's pages to xml files to a SharePoint publishing site for a customer. I have written parsing code to clean up the internal links so that they are are site collection relative and these links remian when the HtmlField is saved. However the site has maybe 300 external links that are properly formated but are still being removed when I call update on the page.ListItem object. Is there any way to turn this validation off?

Thanks David

How to add 2nd parameter to query string in href


I have two datakeys in my gridview - TM_ID and DEPT_ID.  I currently have an Edit button opening a jquery thickbox popup but passing only the TM_ID into the URL.  I need both keys in my URL.  How do I add the DEPT_ID key to the Eval statement below?


              <a id="btnShowPopup" runat="server" class="thickbox" title="Timer Details"
                   href='<%# Eval("TM_ID", "TimerDetail.aspx?TM_ID={0}&TB_iframe=true&height=320&width=500") %>' >Edit</a>




ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend