BC30456, Compiler says something I defined is not a member of my aspx page

E

ericw3

I am switching from Java to the .Net framework.

In order to separate page layout design from the application code, I
studied the codebehind tutorial by John at
http://www.asp101.com/articles/john/codebehindnovs/default.asp

In my GetQueryResult.aspx, I defined a DataGrid as follows:

<asp:DataGrid ID ="dgQueryResults" runat="server"
AllowPaging="True"
PageSize="20"
PagerStyle-Mode="NumericPages"
PagerStyle-HorizontalAlign="Right"
OnPageIndexChanged="dgQueryResult_Page"
BorderColor="black"
BorderWidth="1"
GridLines="Both"
CellPadding="3"
CellSpacing="0"
HeaderStyle-BackColor="#aaaadd"
AlternatingItemStyle-BackColor="#eeeeee" />

And in a VB file separate from GetQueryResult.aspx, I have:

Public Class QueryResult

Sub dgQueryResult_Page(sender As System.Object, _
e As
System.Web.UI.WebControls.DataGridPageChangedEventArgs)
dgQueryResults.CurrentPageIndex = e.NewPageIndex
Call BindData(dgQueryResults)
End Sub

Sub BindData(dgDataGrid As System.Web.UI.WebControls.DataGrid)
'// I defined BindData Sub here and it works great.
End Sub
End Class

But, when I check out the GetQueryResult.aspx page from the browser, I
get the following error message:

Compiler Error Message: BC30456: 'dgQueryResult_Page' is not a member
of 'ASP.query_results_aspx'.

I don't understand this. I do have dgQueryResult_Page defined in the
class. Any idea about what is going on? Thanks.
 
E

ericw3

Hmm, looks like this is a tough question which baffled quite many
professional developers on board. :)
 
B

Bruce Barker

what does you page directive look like? do you have the aspx page inherit
from the codebehind?

-- bruce (sqlwork.com)
 
E

ericw3

Hi, thanks.

Yes, I have in the aspx page:

src="QueryResults.vb"
Inherits = "QueryResults.vb"

Hmm, it probably should be Inherits="QueryResults" instead.

I'll try it out tomorrow, Friday.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top