2

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.

2 Answers 2

1

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">
<html xmlns="http://www.w3.org/1999/xhtml">
<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>
Sign up to request clarification or add additional context in comments.

Comments

0

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 :-;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.