How to use javascript in content page?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • guoyuanliu
    New Member
    • Jul 2008
    • 5

    How to use javascript in content page?

    Hi,

    I have a problem with calling javascript function that will call web service fin ASP.NET AJAX. This is the description:

    When i use one page (.aspx) i place a script manager that reference to .asmx web service reference and write javascript code to call that service on client event. (onchange of a dropdownlist).. it works

    but when i do the same thing in a content page with the a master page which also have a script manager that refer to the same service, it doesn't work . the page load ok but the ajax functionality does not work, and in the bottom-left corner of the browser there is a warning/error icon when i click it says null is null or not an object in lin1 #100 . There is no line #100 in my content file.aspx
    so i viewed source of the browser but doesn't really help me to get what i want


    the Javascript to call the webservice is placed between <asp:content> tag in content page .aspx. I have a scriptmanagerpr oxy is content page but does nothing because the service i want is already defined in master page's script manager


    Please help me !!!!
  • guoyuanliu
    New Member
    • Jul 2008
    • 5

    #2
    Aha got it !,

    When using content page, ASP.NET cannot render the actual ClientID of the control, that's why when i tried to get a hold on it by using $get("ddl"); , .NET does not properly render it to match the actual client id (the client id of the rendered control have some prefix on it), so just use $get( '<#ddl.ClientID >' );
    and it works like a charm

    Comment

    Working...