locked
microsoft jscript runtime error:test is undefined RRS feed

  • Question

  • Hi

    I have 2 master pages 1 inside admin adn 1 outside admin

    jquery function outside admin master page is firing on specific event and same funtions when I copied from that file to adminmaster , i m getting errror

    microsoft jscript runtime error:'functionname'is undefined

    The difference here is

    content page of admin master having jquery function as well , and only those functions are available in viewsource page or firefox->firebug->script

    The function which are inside admin.master are not available at all.

    here is my code for admin.master

     
        </form>
        <asp:ContentPlaceHolder ID="scriptadmin" runat="server"> 
         <script type="text/javascript">
             $(document).bind("mobileinit", function () {
                 // jQuery Mobile's Ajax navigation does not work in all cases (e.g.,
                 // when navigating from a mobile to a non-mobile page), especially when going back, hence disabling it.
                 $.mobile.ajaxEnabled = false;
             });
    
             $("#Logout").click(function (e) {
                 e.stopImmediatePropagation();
                 e.preventDefault();
    
             });
             function test() {
                 alert("Test");
             }
    //         function OnLoginFailed(error, userContext, methodName) {
    //             //alert('Logout failed...'); 
    //         }
    
             function Dologout() {
    
            //     Sys.Services.AuthenticationService.logout(null, OnLogoutSuceeded, OnLoginFailed, null);
    
                // return false;
             }
    
    //         function OnLogoutSuceeded(result, userContext, methodName) {
    //             alert('You have been successfully logged out of the application...');
    //          //   window.location.href("Login.aspx");
    //         } 
    
            </script>
      
              </asp:ContentPlaceHolder>
    </body>
    </html>

    Function called below:


    <div>
                <a href="#" class="ui-btn-left" data-theme="b" data-role="button" data-corners="true"
                    class="ui-btn-left ui-btn ui-shadow  ui-btn-up-b ui-btn-corner-all " data-shadow="true"
                    data-iconshadow="true" data-icon="back">Back</a>
                  <a href="#" class="ui-btn-right btnLogout" data-theme="b" data-role="button" data-corners="true" id="btnLogoutadmin"
            class="ui-btn-left ui-btn ui-shadow  ui-btn-up-b ui-btn-corner-all " data-shadow="true"
            data-iconshadow="true" rel="external"  onclick="test();">Logout</a>
            </div>

    and here is content page

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="XYZ.Admin.Default" MasterPageFile="~/Admin/admin.Master"  %>
    <asp:Content ID="scriptJS" ContentPlaceHolderID="HeadContent" runat="server">
       
    </asp:Content>
    
    <asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
        <h3 class="MainHeader">Upload Excel file to convert into database </h3>
        <asp:Label ID="lblmsg" runat="server" Text="" CssClass="message" ></asp:Label>
    <div class="file-upload-btn">
    	
        <asp:FileUpload ID="FileUpload1" runat="server"  />
    </div>
       <div id ="ButtonWrapper" > <asp:Button ID="btnUpload" runat="server" Text="Upload" data-role="none"
               onclick="btnUpload_Click"    /></div>
    
          
       </asp:Content>
    
    <asp:Content ID="script1" ContentPlaceHolderID="scriptadmin" runat="server">
    
        <%--  <script type="text/javascript">OnClientClick="return ValidateFileName();"
           function ValidateFileName() {
               //          var fu = document.getElementById("<%= FileUpload1.ClientID %>");
               //          var f = fu.value + "";
               //          var reg = /^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.xls|.xlsx|.XLS|.XLSX)$/;
               //          if (fu.value > 0) {    
               //             if (reg.test(f))    {       return true;    }
               //             else { alert("Only EXCEL files are allowed!"); return false; } 
               //              }
               ////          if ((f.indexOf("#", 0) >= 0) || (f.indexOf("$", 0) >= 0) ||
               ////              (f.indexOf("%", 0) >= 0) || (f.indexOf("^", 0) >= 0)) {
               ////              alert("Filename: [" + f + "] contains invalid char");
               ////              return false; //will stop button click event here
               //          }
    
               return true;
           }</script>
     --%>
    
         <script type="text/javascript">
             $(function () {
                 $("#btnUpload").removeClass('ui-btn-hidden ui-btn-inner ui-submit ui-btn ui-shadow ui-btn-corner-all ui-btn-up-b');
                 $("#FileUpload1").removeClass('ui-input-text ui-shadow-inset ui-corner-all ui-btn-shadow ui-body-c file-upload-btn');
             });
        </script>
    </asp:Content>


    Any help would be appreciated!!

    Thanks .

    Sonali Kare




    • Edited by Fluminda Wednesday, February 27, 2013 4:12 PM
    Wednesday, February 27, 2013 2:43 PM

Answers

All replies