Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
95
PageMethods not defined error
posted

Why I keep getting PageMethods not defined error?

<%@ Page  Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="~/AccessRights.aspx.vb" Inherits="AccessRights" title="Access Rights Matrix" 
validateRequest="false" EnableEventValidation="false" MaintainScrollPositionOnPostback="true"
 EnableSessionState="True"  %>
 
 
<%@ Register Assembly="Infragistics45.Web.v13.2, Version=13.2.20132.2028, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" Namespace="Infragistics.Web.UI.NavigationControls" TagPrefix="ig" %>
 
<%@ Register Assembly="Infragistics45.Web.v13.2, Version=13.2.20132.2028, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" Namespace="Infragistics.Web.UI.GridControls" TagPrefix="ig" %>
 
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc6" %>
 
<%@ MasterType VirtualPath="~/MasterPage.master" %>
<%@ Import Namespace="System.Data.SqlClient" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
     <script type="text/javascript" src ="EMS.js">
    </script>   
 
    <link href="css/CustomPager.css" rel="stylesheet" />
 
 
        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" ScriptMode="Release" LoadScriptsBeforeUI="true" ></asp:ScriptManager>
 
 
    <script type ="text/javascript" id="igClientScript">
        function WebDataGrid1_Editing_CellValueChanged(sender, e) {
            var a = $find('<%= WebDataGrid1.ClientID %>');
            var cell = e.get_cell();
 
            if (cell.get_column().get_key() == "Read") {
                if (cell.get_value() == false) {
                    cell.get_row().get_cell(2).set_value(false);
                    cell.get_row().get_cell(3).set_value(false);
                }
            }
 
            if (cell.get_column().get_key() == "Update") {
                if (cell.get_value() == true) {
                    cell.get_row().get_cell(1).set_value(true);
                }
            }
 
            if (cell.get_column().get_key() == "Delete") {
                if (cell.get_value() == true) {
                    cell.get_row().get_cell(1).set_value(true);
                }
            }
 
            if (a.get_behaviors().get_editingCore().get_editedRows().length > 0) {
                var x = document.getElementById('<%= HiddenFieldCancel.ClientID%>');
                x.value = 'No';
 
                document.getElementById('<%=ButtonLoadMatrix.ClientID%>').disabled = true;
                document.getElementById('<%=DropDownListGroup.ClientID%>').disabled = true;
                document.getElementById('<%=DropDownListModule.ClientID%>').disabled = true;
                
                setMenu(false);
            }
            else {
                var x = document.getElementById('<%= HiddenFieldCancel.ClientID%>');
                x.value = 'Yes';
 
                document.getElementById('<%=ButtonLoadMatrix.ClientID%>').disabled = false;
                document.getElementById('<%=DropDownListGroup.ClientID%>').disabled = false;
                document.getElementById('<%=DropDownListModule.ClientID%>').disabled = false;
 
                setMenu(true);
            }
        }
 
        function setMenu(parMenu) {
            var menu = $find('<%=Master.MasterMenu.ClientID()%>');  // Get the MainMenu on the master page
        
           
            var result = PageMethods.menuActive(false, OnSuccess, OnError);
       
     
 
 
//            menu.disabled = false;
 
       //     var item = menu.findItemByText("Setup");
       //     item.get_element().style.cssText = "display: none;";  // Hide the item
 
    
        //    menu.getItems().getItem(0).set_enabled(parMenu);
        //    menu.getItems().getItem(1).set_enabled(parMenu);
        //    menu.getItems().getItem(2).set_enabled(parMenu);
        }
 
        function OnSuccess(response) {
            alert(response);
        }
        function OnError(error) {
            alert(error);
        }
 
        function WebDataGrid1_Editing_CellValueChanging(sender, e) {
            if (e.get_cell().get_column().get_key() == "Read") 
            {
            }
            else {
                if (e.get_cell().get_row().get_tag() == true) {
                    e.set_cancel(true);
                }
            }
        }
 
    </script>
 
    <script type="text/javascript">
        var checkChangesEnabled = true;
        window.onbeforeunload = yyy;  // confirmExit;    // yyy;
 
        function yyy() {
            if (document.getElementById('<%=ButtonLoadMatrix.ClientID%>').disabled == true) {
                if (checkChangesEnabled) {
                    if (navigator.appName == "Microsoft Internet Explorer") {
                        // IE only...
                        window.event.returnValue = "Changes you have made will be saved!";
                    }
                    else {
                        // Other browsers...
                        return "Changes you have made will be saved!";
                    }
                    disableCheck();
                }
            }
        }
 
        function confirmExit() {
            if (document.getElementById('<%=ButtonLoadMatrix.ClientID%>').disabled == true)
            {
                if (checkChangesEnabled) {
                    event.returnValue = "Changes you have made will not be saved!";
                    disableCheck();
                }
            }
        }
 
        function disableCheck() {
            checkChangesEnabled = false;
            setTimeout("enableCheck()""100");
        }
 
        function enableCheck() {
            checkChangesEnabled = true;
        }
 
        function xxx() {
            var x = document.getElementById('<%= HiddenFieldCancel.ClientID%>');
            x.value = 'Yes';
            __doPostBack('<%= ButtonUpdate.UniqueID%>''');
 
            setMenu(true);
        }
 
        function checkedAll(parCellNo)
        {
            var grid = $find('<%=WebDataGrid1.ClientID%>');
            var rowsLength = grid.get_rows().get_length();
 
            for (var i = 0; i < rowsLength; i++) {
                var currentRow = grid.get_rows().get_row(i);
                var currentCell = currentRow.get_cell(parCellNo);
                var currentVal = currentCell.get_value();
 
                if (currentCell.get_row().get_tag() == true) {
                    if (parCellNo != 1)
                        grid.get_rows().get_row(i).get_cell(parCellNo).set_value(false);
                    else
                        grid.get_rows().get_row(i).get_cell(parCellNo).set_value(true);
                }
                else
                    grid.get_rows().get_row(i).get_cell(parCellNo).set_value(true);
            }
        }
 
        function uncheckedAll(parCellNo) {
            var grid = $find('<%=WebDataGrid1.ClientID%>');
            var rowsLength = grid.get_rows().get_length();
 
            for (var i = 0; i < rowsLength; i++) {
                var currentRow = grid.get_rows().get_row(i);
                var currentCell = currentRow.get_cell(parCellNo);
                var currentVal = currentCell.get_value();
 
                grid.get_rows().get_row(i).get_cell(parCellNo).set_value(false);
            }
        }
    </script>
 
 
      <asp:UpdatePanel ID="UpdatePanel1" runat="server">
         <ContentTemplate>
            <asp:Panel 
                ID="PanelTop" runat="server" Style="z-index0left0%positionrelativetop0%width :100%height : 30px;" BackColor="Transparent">
 
                <asp:Label
                    Style="border-widththinPADDING-LEFT5pxZ-INDEX101LEFT10pxPOSITIONabsoluteTOP5pxwidth83px;"
                    ID="LabelModule"
                    runat="server"
                    Font-Bold="False"
                    Height="20px"
                    Font-Names="Tahoma"
                    BorderWidth="1px"
                    BorderStyle="Ridge"
                    ForeColor="White"
                    Font-Size="12px"
                    Text="Module"
                    BackColor="#C00000" CssClass="LabelClass"> </asp:Label>
 
                <asp:DropDownList 
                    ID="DropDownListModule" 
                    runat="server" 
                    AppendDataBoundItems="True"
                    AutoPostBack="False" 
                    Font-Names="Tahoma" 
                    Height="22px" 
                    Style="border1px solid #ccccffpadding-left5pxz-index101left104pxpositionabsolutetop6pxfont-size12pxfont-familytahoma;" 
                    Width="330px" 
                    Font-Size="12px" >
                    <asp:ListItem Selected="True">IRAS</asp:ListItem>
                </asp:DropDownList>
                            
                <asp:Label 
                    ID="LabelGroup" 
                    runat="server" 
                    BackColor="#C00000" 
                    BorderStyle="Ridge"
                    Font-Bold="False" 
                    Font-Names="Tahoma" 
                    Font-Size="12px" 
                    Height="20px" 
                    Style="border-widththinpadding-left5pxz-index102left455pxfont-familyTahomapositionabsolutetop5pxwidth84px;" 
                    Text="Group" 
                    BorderWidth="1px" 
                    ForeColor="White"></asp:Label>
                                
                <asp:DropDownList 
                    ID="DropDownListGroup" 
                    runat="server" 
                    AppendDataBoundItems="True"
                    AutoPostBack="False" 
                    DataTextField="User Group" 
                    DataValueField="User Group" 
                    Font-Names="Tahoma"
                    Height="22px" 
                    Style="border1px solid #ccccffpadding-left5pxz-index103left551pxpositionabsolutetop6pxfont-size12pxfont-familytahoma;" 
                    Width="330px" 
                    Font-Size="12px" >
                    <asp:ListItem>(empty)</asp:ListItem>
                </asp:DropDownList>
                            
                <asp:Button 
                    ID="ButtonLoadMatrix" 
                    runat="server" 
                    Height="24px" 
                    Style="z-index105left895pxpositionabsolutetop3px" 
                    Text="Load Matrix" 
                    Width="87px" 
                    OnClick="ButtonLoadMatrix_Click" 
                    Font-Names="Tahoma" 
                    Font-Size="12px" />
            </asp:Panel>
 
            <asp:Panel 
                ID="PanelGrid" 
                runat="server"  
                Height="450px" 
                Width="100%" 
                style="positionrelativeleft0%top0%;">
 
 
                <asp:HiddenField ID="HiddenFieldCancel" runat="server" Value="No" />
                <ig:WebDataGrid 
                    ID="WebDataGrid1" 
                    runat="server" 
                    AutoGenerateColumns="False" 
                    DataSourceID="SqlDataSource1" 
                    Height="98%" 
                    Width="100%" 
                    DataKeyFields="System, User_Group, Function" EnableAjaxViewState="False">
                    <Columns>
                        <ig:BoundDataField DataFieldName="Function" Key="Function" Width ="50%">
                            <Header Text="Function">
                            </Header>
                        </ig:BoundDataField>
                        <ig:BoundCheckBoxField DataFieldName="Read" Key="Read" Width ="10%">
                            <Header Text="Read">
                            </Header>
                        </ig:BoundCheckBoxField>
                        <ig:BoundCheckBoxField DataFieldName="Update" Key="Update" Width ="10%">
                            <Header Text="Update">
                            </Header>
                        </ig:BoundCheckBoxField>
                        <ig:BoundCheckBoxField DataFieldName="Delete" Key="Delete" Width ="10%">
                            <Header Text="Delete">
                            </Header>
                        </ig:BoundCheckBoxField>
                        <ig:BoundDataField DataFieldName="Function_Type" Key="Function_Type">
                            <Header Text="Function_Type">
                            </Header>
                        </ig:BoundDataField>
                        <ig:BoundDataField DataFieldName="System" Key="System" Hidden ="true" >
                            <Header Text="System">
                            </Header>
                        </ig:BoundDataField>
                        <ig:BoundDataField DataFieldName="User_Group" Key="User_Group" Hidden ="true">
                            <Header Text="User_Group">
                            </Header>
                        </ig:BoundDataField>
                    </Columns>
                    <Behaviors>
                        <ig:EditingCore AutoCRUD="False" BatchUpdating="True">
                            <EditingClientEvents CellValueChanged="WebDataGrid1_Editing_CellValueChanged" CellValueChanging="WebDataGrid1_Editing_CellValueChanging" />
                            <Behaviors>
                                <ig:CellEditing>
                                    <ColumnSettings >
                                        <ig:EditingColumnSetting ColumnKey="Function" ReadOnly ="true" />
                                        <ig:EditingColumnSetting ColumnKey="Read" ReadOnly ="false" />
                                        <ig:EditingColumnSetting ColumnKey="Update" ReadOnly ="false" />
                                        <ig:EditingColumnSetting ColumnKey="Delete" ReadOnly ="false" />
                                        <ig:EditingColumnSetting ColumnKey="Function_type" ReadOnly ="true" />
                                        <ig:EditingColumnSetting ColumnKey="System" ReadOnly ="true" />
                                        <ig:EditingColumnSetting ColumnKey="User_Group" ReadOnly ="true" />
                                    </ColumnSettings>
                                </ig:CellEditing>
                            </Behaviors>
                        </ig:EditingCore>
                        <ig:Selection>
                        </ig:Selection>
                        <ig:RowSelectors>
                        </ig:RowSelectors>
                        <ig:Sorting>
                        </ig:Sorting>
                        <ig:Activation>
                        </ig:Activation>
                    </Behaviors>
                </ig:WebDataGrid>
 
 
                <asp:SqlDataSource ID="SqlDataSource1" runat="server"
                    ConnectionString="<%$ ConnectionStrings:IRASConnectionString %>"
                    DeleteCommand="DELETE FROM [Access Rights] WHERE [Function] = @original_Function AND [System] = @original_System AND [User Group] = @original_User_Group" 
                    InsertCommand="INSERT INTO [Access Rights] ([Function], [Read], [Update], [Delete], [Function Type], [System], [User Group]) VALUES (@Function, @Read, @Update, @Delete, @Function_Type, @System, @User_Group)" OldValuesParameterFormatString="original_{0}" 
                    SelectCommand="SELECT [Function], [Read], [Update], [Delete], [Function Type] AS Function_Type, [System], [User Group] AS User_Group FROM [Access Rights] WHERE (([System] = @System) AND ([User Group] = @User_Group)) ORDER BY [Function]" 
                    UpdateCommand="UPDATE [Access Rights] SET [Read] = @Read, [Update] = @Update, [Delete] = @Delete, [Function Type] = @Function_Type WHERE [Function] = @original_Function AND [System] = @original_System AND [User Group] = @original_User_Group">
                    <DeleteParameters>
                        <asp:Parameter Name="original_Function" Type="String" />
                        <asp:Parameter Name="original_System" Type="String" />
                        <asp:Parameter Name="original_User_Group" Type="String" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter Name="Function" Type="String" />
                        <asp:Parameter Name="Read" Type="Boolean" />
                        <asp:Parameter Name="Update" Type="Boolean" />
                        <asp:Parameter Name="Delete" Type="Boolean" />
                        <asp:Parameter Name="Function_Type" Type="String" />
                        <asp:Parameter Name="System" Type="String" />
                        <asp:Parameter Name="User_Group" Type="String" />
                    </InsertParameters>
                    <SelectParameters>
                        <asp:ControlParameter ControlID="DropDownListModule" Name="System" PropertyName="SelectedValue" Type="String" />
                        <asp:ControlParameter ControlID="DropDownListGroup" Name="User_Group" PropertyName="SelectedValue" Type="String" />
                    </SelectParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="Read" Type="Boolean" />
                        <asp:Parameter Name="Update" Type="Boolean" />
                        <asp:Parameter Name="Delete" Type="Boolean" />
                        <asp:Parameter Name="Function_Type" Type="String" />
                        <asp:Parameter Name="original_Function" Type="String" />
                        <asp:Parameter Name="original_System" Type="String" />
                        <asp:Parameter Name="original_User_Group" Type="String" />
                    </UpdateParameters>
                </asp:SqlDataSource>
            </asp:Panel> 
                        
            <asp:Panel 
                ID="PanelAction" 
                runat="server" 
                BackColor="LightSteelBlue" 
                Height="36px" 
                Style="z-index101left0pxpositionrelativebackground-color#c00000;" 
                Width="1005px">
 
                <asp:Label 
                    ID="LabelMode" 
                    runat="server" 
                    BorderStyle="None" 
                    Font-Bold="False" 
                    Font-Names="Tahoma"
                    Font-Underline="False" 
                    Style="z-index100left12pxfont-familyTahomapositionabsolutetop8pxFONT-SIZE12pxcolorwhite;" 
                    Text="Enquiry Mode" 
                    Width="92px" ForeColor="Black" Font-Size="12px"></asp:Label>
 
                   <asp:Button 
                    ID="ButtonEnableRead" 
                    runat="server" 
                    Enabled="True" 
                    Height="28px" 
                    Style="z-index101left176pxpositionabsolutetop4px"
                    Text="Enable All Read" 
                    Width="108px" Font-Names="Tahoma" Font-Size="12px" OnClientClick="checkedAll(1); return false;" />
                                
                  <asp:Button 
                    ID="ButtonDisableRead" 
                    runat="server" 
                    Enabled="True" 
                    Height="28px" 
                    Style="z-index101left285pxpositionabsolutetop4px"
                    Text="Disable All Read" 
                    Width="108px" Font-Names="Tahoma" Font-Size="12px" OnClientClick="uncheckedAll(1); return false;" />
 
                 <asp:Button 
                    ID="ButtonEnableUpdate" 
                    runat="server" 
                    Enabled="True" 
                    Height="28px" 
                    Style="z-index101left394pxpositionabsolutetop4px"
                    Text="Enable All Update" 
                    Width="108px" Font-Names="Tahoma" Font-Size="12px" OnClientClick="checkedAll(2); return false;" />
                                
                  <asp:Button 
                    ID="ButtonDisableUpdate" 
                    runat="server" 
                    Enabled="True" 
                    Height="28px" 
                    Style="z-index101left503pxpositionabsolutetop4px"
                    Text="Disable All Update" 
                    Width="108px" Font-Names="Tahoma" Font-Size="12px" OnClientClick="uncheckedAll(2); return false;" />
 
                 <asp:Button 
                    ID="ButtonEnableDelete" 
                    runat="server" 
                    Enabled="True" 
                    Height="28px" 
                    Style="z-index101left612pxpositionabsolutetop4px"
                    Text="Enable All Delete" 
                    Width="108px" Font-Names="Tahoma" Font-Size="12px" OnClientClick="checkedAll(3); return false;" />
                                
                  <asp:Button 
                    ID="ButtonDisableDelete" 
                    runat="server" 
                    Enabled="True" 
                    Height="28px" 
                    Style="z-index101left721pxpositionabsolutetop4px"
                    Text="Disable All Delete" 
                    Width="108px" Font-Names="Tahoma" Font-Size="12px" OnClientClick="uncheckedAll(3); return false;" />
 
                <asp:Button 
                    ID="ButtonCancel" 
                    runat="server" 
                    Enabled="False" 
                    Height="28px" 
                    Style="z-index101left915pxpositionabsolutetop4px"
                    Text="Cancel" 
                    Width="84px" Font-Names="Tahoma" Font-Size="12px" OnClientClick="return xxx();" />
                            
                <asp:Button 
                    ID="ButtonUpdate" 
                    runat="server" 
                    Enabled="False" 
                    Height="28px" 
                    Style="z-index102left830pxpositionabsolutetop4px" 
                    Text="Save" 
                    Width="84px" Font-Names="Tahoma" Font-Size="12px" />
            </asp:Panel>
         </ContentTemplate>
     </asp:UpdatePanel> 
 
 
    <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1" Visible="true"    >
        <ProgressTemplate>
            <div 
                style="position:absolute;  
                top : 30%; 
                left : 40%;
                width:30%; 
                height:12%; 
                background-color:black; 
                color:yellow; 
                border-top : ridge 3px gray;
                border-bottom : ridge 3px gray;
                border-left : ridge 3px gray;
                border-right : ridge 3px gray;
                margin-left:auto;margin-right:auto;">
                <br />
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please wait ... <img src="ajax-loader-yellow-black.gif" style="position:relative;" />
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>
</asp:Content>
Parents
No Data
Reply
  • 95
    Offline posted

    This is the exact error message:

    0x800a1391 - Microsoft JScript runtime error: 'PageMethods' is undefined

Children