Error BC30456: '[Method]' is not a member of 'ASP. [CodeBehind] _aspx '

Pretty simple question. I am pretty sure that I have a class, method, codebehind, etc. Which are connected correctly. Many posts on the Internet say that this has something to do with compilation and / or dll / bin files, but none of them helped me.

Compiler Error Message: BC30456: 'gvLegs_PageIndexChanging' is not a member of 'ASP.nestedgridview_aspx'. Source Error: Line 43: <asp:Label ID="lblEmpName" runat="server" Text='<%# Eval("Location")%>'></asp:Label> Line 44: <asp:Literal runat="server" ID="lit1" Text="</td><tr id='trCollapseGrid' style='display:none' ><td colspan='5'>" /> Line 45: <asp:GridView ID="gvLegs" AutoGenerateColumns="False" runat="server" EnableViewState="False" Line 46: DataKeyNames="EmployeeId" ForeColor="#333333" PageSize="4" AllowPaging="True" Line 47: OnPageIndexChanging="gvLegs_PageIndexChanging"> Source File: C:\Users\tstanley\Desktop\NestedVB\NestedVB\NestedGridView.aspx Line: 45 

NestedGridView.aspx

 <%@ Page Language="vb" AutoEventWireup="false" codebehind="NestedGridView.aspx.vb" Inherits="NestedVB.NestedGridViewPaging2" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

NetedGridView.aspx.vb [Code behind] ...

  Private Sub gvLegs_PageIndexChanging(sender As Object, e As GridViewPageEventArgs) 

If anyone has a fix for this, this will help me a lot, so I can continue ... by debugging the actual lol code.

+5
source share
1 answer

gvLegs_PageIndexChanging is private, but needs to be protected or published.

Since you are using VB.NET, you can also use the handles clause :

 Private Sub gvLegs_PageIndexChanging(sender As Object, e As GridViewPageEventArgs) _ Handles gvLegs.PageIndexChanging End Sub 

Change To be clear, you have three options in ASP.NET with VB.NET to create event handlers:

If you use parameter 1, the event handler must be at least protected, since the aspx page inherits from the codebehind class.

If you use option 2, the method may be private, but you need to remove the descriptive event handler on aspx.

+10
source

All Articles