none
Cannot get javascript function to execute RRS feed

  • Question

  • I am having all kinds of problems getting a simple javascript function to execute when I click a button on y web page. Can someone please help? What am I doing wrong?

    The below code gives me this error:

    Compiler Error Message: BC30456: 'GetTheIndex' is not a member of 'viewexisting_aspx'.

    <%@ Page Title="View Request" 
        Language="vb" 
        AutoEventWireup="false" 
        MasterPageFile="~/Site.Master" 
        CodeBehind="ViewExisting.aspx.vb" 
        Inherits="IT_Requests.ViewRequest" %>

    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>


    <asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
        <link href="StyleSheet1.css" rel="stylesheet" type="text/css" />



        <script type="text/javascript">
            
            function GetTheIndex() {
                alert("In GetTheIndex.");
            }
        </script>



     <%--       $(document).ready(function () {
                $(".accordionHeader").on("click", function () {
                    $('#myHiddenField').val($("#acrDynamic_AccordionExtender_ClientState").val());
                });
                $(".accordionHeaderSelected").on("click",function () {
                    $('#myHiddenField').val($("#acrDynamic_AccordionExtender_ClientState").val());
                });
            });


        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>--%>

            <ajaxToolkit:Accordion ID="acrDynamic" runat="server" 
                SelectedIndex="0" 
                HeaderCssClass="headerAccordion" 
                HeaderSelectedCssClass="headerAccordionSelected"
                ContentCssClass="contentAccordion" 
                >
            </ajaxToolkit:Accordion>


            
            <asp:UpdatePanel ID="UpdatePanel1" runat="server"  ChildrenAsTriggers="False" UpdateMode="Conditional" >
                <ContentTemplate>

                <asp:HiddenField ID="myHiddenField" runat="server" />
                <asp:Button ID="btnShowMore" runat="server" Text="Show More" />
                <asp:Button ID="btnSaveChanges" runat="server" Text="Save Changes" onclick="GetTheIndex()"/>   

                <asp:Label ID="lblDebugSelected" runat="server" Text="Selected Index: "></asp:Label>
                    
                </ContentTemplate>
            </asp:UpdatePanel>



       
        </asp:Content>

    Friday, July 12, 2019 1:48 PM