locked
Getting a run-time error that Timer3_tick is not a member of WebForm1_aspx??? RRS feed

  • Question

  • User-337325487 posted

    Hi there,

    I'm getting an error and did everything I can to best of my knowledge; still having an error.  See below asp.net page code (Note: I have two timers):

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title></title>
    </head>
    <body>
    <form id="form1" runat="server" style="margin: 50px; clip: rect(auto, auto, auto, auto)" submitdisabledcontrols="True">
    <h1 style="border-style: solid; background-color:aquamarine; width:866px; color: #0000FF; text-align: center;">Open Time Slots by Provider</h1>
    <div>

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

    <asp:Timer ID="Timer3" runat="server" OnTick="Timer3_Tick">
    </asp:Timer>

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

    <ContentTemplate>
    <asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1" PageSize="20" AutoGenerateColumns="False" Width="875px" >

    <Columns>
    <asp:BoundField DataField="Loc" HeaderText="Location">
    <HeaderStyle BackColor="#CCCCCC" BorderColor="Black" BorderStyle="Solid" Height="50px" HorizontalAlign="Center" Font-Bold="True" Font-Size="Large" />
    <ItemStyle BackColor="#00FF99" BorderStyle="Solid" Font-Bold="True" Font-Size="Medium" Height="30px" HorizontalAlign="Center" Width="150px" Wrap="False" VerticalAlign="Middle" />
    </asp:BoundField>
    <asp:BoundField DataField="ProvName" HeaderText="Provider Name">
    <HeaderStyle BackColor="#CCCCCC" BorderColor="Black" BorderStyle="Solid" HorizontalAlign="Center" Font-Bold="True" Font-Size="Large" />
    <ItemStyle BackColor="#00CCFF" BorderStyle="Solid" Font-Bold="True" Font-Size="Medium" Height="40px" HorizontalAlign="Center" Width="150px" Wrap="False" VerticalAlign="Middle" />
    </asp:BoundField>
    <asp:BoundField DataField="AptBeginTime" HeaderText="Available Time Slot">
    <HeaderStyle BackColor="#CCCCCC" BorderColor="Black" BorderStyle="Solid" HorizontalAlign="Center" Font-Bold="True" Font-Size="Large" />
    <ItemStyle BackColor="#00FF99" Font-Bold="True" Font-Size="Medium" HorizontalAlign="Center" Wrap="False" BorderStyle="Solid" Width="40px" VerticalAlign="Middle" />
    </asp:BoundField>
    </Columns>
    </asp:GridView>
    </ContentTemplate>
    <Triggers>
    <asp:AsyncPostBackTrigger ControlID="Timer3" EventName="Tick" />
    </Triggers>

    </asp:UpdatePanel>



    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ReportsConnectionString %>" SelectCommand="Test_TimeSlotRetrievePartialData" SelectCommandType="StoredProcedure"></asp:SqlDataSource>

    <asp:Timer ID="Timer2" runat="server" OnTick="Timer2_Tick">
    </asp:Timer>

    </form>

    Thank you for assistance that you can for provide.

             Orhan Erten (Informatics in a Healthcare Company)

    Thursday, June 7, 2018 9:22 PM

All replies

  • User-1716253493 posted

    Do you have something like this

        Protected Sub Timer3_Tick(sender As Object, e As EventArgs)
    
        End Sub

    Friday, June 8, 2018 2:22 AM
  • User-330142929 posted

    Hi Oerten,

     

    According to your description, I test your codes in local, and I cannot reproduce your issue.

    Could you post more details or error messages regarding issue? It will be helpful for us to troubleshoot this issue furtherly.

    Look forward to your reply.

    Best Regards, 

    Abraham

    Friday, June 8, 2018 5:33 AM
  • User-337325487 posted

    Hi Abraham,

    Let me describe.  I've been recommended for using two timer controls in this app.  I'm using GridView control and pulling data.  Most cases my data does not fit into 20 rows so I have to go onto second part of recordset to display another 2O and so on.  This app will work in Kiosk mode so when it comes to last page then it should come back to display the first page again.  I want grid refresh to be every 30 seconds then whole data (requery or call database for fetching latest recordset again) to be refreshed every 10 min.  I was using a working with a my authored demo ASP.NET app  (hitting database up every 30 seconds, using control table to increment pages then when get to page 10 (go back to page 1 - this is for demo purposes)).  I created a second timer onto that development app and I defined interval and tick event on it.  But for some reason, when I run it then I would get runtime error similar to what I have for this forum issue title.  

    So I hope this helps and if you need any other information please let me know.

    Thank you and Regards,

            Orhan

    Friday, June 8, 2018 4:23 PM
  • User-330142929 posted

    Hi Oerten,

    I am sorry for the late response. According to your descritption, I guess your problem is that Timer3_Tick is private. Internally .aspx file is represented by a class that inherits from code behind class, so private methods are not visible for it.

    I make a demo and reproduce your problem successfully.

     I suggest you  could make  it protected and everything should work fine.

    Please feel free to let me know if the problem still exists.

     

    Best Regards,

    Abraham

    Tuesday, June 12, 2018 6:21 AM