div ASP onclick event

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • raulbolanos
    New Member
    • Apr 2009
    • 31

    div ASP onclick event

    Hi guys, I have the followin problem.

    I need to execute from the .aspx file a code-behind function on onClick event.

    When I run the project, the ASP sentence is beign execute before show the whole HTML or click the tag.

    How can I avoid this? I really need to run this code-behind function after clicking the DIV dat.

    I would appreciate any kind of help.

    Thank you in advance.

    Code:
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="_Default" %>
    <%@ Import Namespace="System.IO" %>
    
    <HTML>
     <HEAD>
     </HEAD>
     <body>
      <form id="Form1" runat="server">
        <input type="hidden" id="perguntarAbrir" value="test"/>
        <div id="ejemploHTML" onclick="<% preguntarAbrir("C:\\var\\ejemplo.pdf"); %>; ">HTML Link</div><br />
        <br />
      </form>
     </body>
    </HTML>
    Last edited by Frinavale; Jul 12 '10, 07:00 PM. Reason: Please post code in [code] ... [/code] tags. Added code tags.
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    You can handle the onclick event for a <div> element using JavaScript. You can submit the page to the server for processing using JavaScript.

    -Frinny

    Comment

    Working...