How to call javascript in hyperlinkfield

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • indhu kumar
    New Member
    • Nov 2010
    • 1

    How to call javascript in hyperlinkfield

    I have a hyperlinkfield in the gridview. when i click on that it take some time to redirect to other page, during that time i want to intimate the user with a "pleasewait " message using javascript.

    I have written a script for that and i want to call it in hyperlinkfield.
    I tired using DataNavigateUrl FormatString="j avascript:varwi n=window.open(' Detail.aspx?mop Id={0}');" but it doesnt work

    Here is my hyperlinkfield code:
    <asp:hyperlinkf ield HeaderText="ID" SortExpression= "id" DataTextField=" id"
    DataNavigateUrl Fields="id,as_o f_date" DataNavigateUrl FormatString="d efault.aspx?mrs ecid={0}&aod={1 :dd-MMM-yyy}" />
    and i'm using vb.net.

    Please help me in finding solution for the above.
    Last edited by Dormilich; Nov 26 '10, 10:09 AM.
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    For a "Please Wait..." message, you can place an element on the page with the message, then onclick show this element, e.g.
    Code:
    <div id="message">Please wait...</div>
    This should initially be hidden. Then:
    Code:
    <a ... onclick="document.getElementById('message').style.display='block'">
    I have used inline events for the sake of simplicity/brevity. Also note that VB.NET may have something which could generate this for you.

    Comment

    • johny10151981
      Top Contributor
      • Jan 2010
      • 1059

      #3
      this is also widely used :
      <a href='javascrip t:YourFunction( )'>click me :)</a>

      Comment

      Working...