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

前端 未结 1 1449
一生所求
一生所求 2021-01-05 15:05

Pretty simple question. I\'m quite certain I have the Class, method, codebehind, etc linked properly. Lot\'s of posts online say that this has something to do with compiling

相关标签:
1条回答
  • 2021-01-05 15:44

    gvLegs_PageIndexChanging is private but needs to be protected or public.

    Since you're using VB.NET you could also use the handles clause:

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

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

    1. declaratively on aspx
    2. in code with handles clause
    3. with AddHandler (mostly for dynamical controls in VB.NET)

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

    If you use option 2 the method can be private but you need to remove the declarative event handler on the aspx.

    0 讨论(0)
提交回复
热议问题