Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Asp.net 2: Master Pages, ContentPlaceHolders and Javascript function flabbergastery

Options
  • 16-02-2006 5:10pm
    #1
    Closed Accounts Posts: 24


    All,

    I'm trying to run a client-side javascript function on my asp.net (2) page. The page in question is actually a ContentPlaceHolder with a MasterPage (make sense to anyone?).

    So the problem is the JavaScript functions aren't defined, apparently, although they are. I can't define them in the MasterPage as that will affect the rest of the team. Anyone know how to get around this?
    P.F.
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
        <script language="javascript">
            function PopulateRequiredSampleSize(){
    			alert('hello'); // even this won't execute
    		}
        </script>
    
     <!-- yadda yadda yadda -->
    


    Calling it from this:
    [html]
    <input id="txtPop" type="text" onblur="PopulateRequiredSampleSize();" />
    [/html]


Comments

  • Closed Accounts Posts: 140 ✭✭Sneaky_Russian


    hate to point out the obvious but the you have a function defined called CalculateRequiredSampleSize(population) but you are are calling PopulateRequiredSampleSize()

    i take it thats a cut and paste issue as opposed to your actual problem :)


  • Closed Accounts Posts: 24 Phileas Fogg


    Cut and paste it was, fixed now.


  • Closed Accounts Posts: 140 ✭✭Sneaky_Russian


    i am a bit confused on what you are trying to do.
    i tested it it by creating a master page, then creating the client page below.
    works fine....

    [HTML]<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Title="Untitled Page" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

    <script language="javascript">
    function PopulateRequiredSampleSize(){
    alert('hello'); // even this won't execute
    }
    </script>

    <input id="txtPop" type="text" onblur="PopulateRequiredSampleSize();" type=text />
    <!-- added so i can "blur" out of the above text box -->
    <input id="Text1" type="text" type=text />
    </asp:Content>
    [/HTML]


Advertisement