views:

36

answers:

3

Hey, I created a ASP.NET regular project, and I am trying to attach an on click event to 'btn1'.

and I have few issues -

  1. function pageLoad -> don't working for checking if the dom is ready
  2. $addHandler,$get intellisense don`t work

how I can fix it?

EDIT : And I don`t have intellisense for Sys variable.

+1  A: 

Did you include a script manager on the page? Here's an example that should work:

<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml"&gt;
<head>
    <title>Example</title>
    <script type="text/javascript">
    function pageLoad(sender, args) {
        Sys.UI.DomEvent.addHandler(
            $get('Button1'), 'click', function(eventElement) {
                alert('button clicked');
        });
    }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"/>
        <asp:Button ID="Button1" runat="server" Text="Button" />
    </form>
</body>
</html>
Darin Dimitrov
I have fixed the problem,Thank you!
Yosy
A: 

Hello,

I must say that most times I don't have intellisense working either. The reason I don't know, but I work without it and my pages work fine. Sorry to add a defeatist post :-;

Brian