473,480 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

not a member of 'ASP.default_aspx

Hello,

I'm trying to streamline an app by converting inline code into a
functions.vb file in the App_Code folder but can't seem to work out
this error: The code worked fine in its "inline version".

BC30456: 'LinkCat_ItemDataBound' is not a member of 'ASP.default_aspx

Line 45: <asp:DataList id="LinkCat" RepeatColumns="2"
RepeatDirection="Horizontal" OnItemDataBound="LinkCat_ItemDataBound"
runat="server">

Many thanks in advance.

default.aspx
<%@ Page Language="VB" MasterPageFile="site.master" Debug="True"%>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.Oledb" %>
<%@ import Namespace="System.Configuration" %>

<script runat="server">

'++++++++++++++++++++++++++++++++++++++++++++
'Handle the page load event
Sub Page_Load(Sender As Object, E As EventArgs)
dim Display_Category,Total_Link_Count,Display_Letter_L inks
'Display all categories
Display_Category.Display_Category

'Call Total Link Count - get the number links
Total_Link_Count.Total_Link_Count
'Call risplay link name A to Z
Display_Letter_Links.Display_Letter_Links

Display_Letter_Links.lblletter.Text = "Link Name A-Z:"

End Sub
'++++++++++++++++++++++++++++++++++++++++++++

</script>

functions.vb (in App-Code)

Imports System
Imports System.Data
Imports System.Data.OleDb
Imports Microsoft.VisualBasic

Namespace MyXD
Module myModule
'++++++++++++++++++++++++++++++++++++++++++++
'Declare public so it will accessible in all subs
Public strConnection
Public objConnection
Public objCommand
Public strSQL as string
Public iRandomLink as integer
Public strSubCatName as string
'++++++++++++++++++++++++++++++++++++++++++++

'++++++++++++++++++++++++++++++++++++++++++++
'Database connection string - Open database
Public Class DBconnect

Public Shared Sub DBconnect()

strConnection = ConfigurationSettings.AppSettings("MyXD")

objConnection = New OledbConnection(strConnection)
objCommand = New OledbCommand(strSQL, objConnection)
objConnection.Open()

End Sub
End Class
'++++++++++++++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++++++++++++++
'Display all categories with count
Public Class Display_Category

Public Shared Sub Display_Category()
dim strSQL,lbltotalCat,LinkCat

strSQL = "SELECT *, (SELECT COUNT (*) FROM LINKS WHERE LINKS.CAT_ID =
CATEGORY.CAT_ID AND LINK_APPROVED = 1) AS REC_COUNT FROM CATEGORY ORDER
BY CAT_NAME ASC"

'Call Open database - connect to the database

DBconnect.DBconnect()

Dim LinkAdapter as New OledbDataAdapter(objCommand)
Dim dts as New DataSet()
LinkAdapter.Fill(dts, "CAT_ID")

lbltotalCat.Text = CStr(dts.Tables(0).Rows.Count) &
"&nbsp;categories"

LinkCat.DataSource = dts.Tables("CAT_ID").DefaultView
LinkCat.DataBind()

'Close database connection
objConnection.Close()
End Sub
End Class
'++++++++++++++++++++++++++++++++++++++++++++

'++++++++++++++++++++++++++++++++++++++++++++
'Show an Item in a Bound List - Display sub categories

Public Class LinkCat_ItemDataBound

Public Shared Sub LinkCat_ItemDataBound(sender As Object, e As
DataListItemEventArgs)

'First, make sure we're not dealing with a Header or Footer row
If e.Item.ItemType <> ListItemType.Header AND e.Item.ItemType <>
ListItemType.Footer then

Dim intCatID as integer
Dim strSQL2 as string

intCatID = DataBinder.Eval(e.Item.DataItem, "CAT_ID")

Dim subnamelabel As Label =
CType(e.Item.FindControl("lblsubname"), Label)

'SQL display details and rating value
strSQL2 = "SELECT * FROM SUBCATEGORY WHERE CAT_ID=" & intCatID
& " Order by SUB_NAME DESC"

Dim objDataReader as OledbDataReader

objConnection = New OledbConnection(strConnection)
objCommand = New OledbCommand(strSQL2, objConnection)

objConnection.Open()
objDataReader = objCommand.ExecuteReader()

'Read data
objDataReader.Read()

Dim intSID as integer = objDataReader("SUB_ID")

subnamelabel.text = subnamelabel.text & "<a class=""dt3"" title=""Go to
" & objDataReader("SUB_NAME") &" Sub-Category""
href=""pageview.aspx?tab=" & 1 & "&catid=" & intCatID & "&subid=" &
intSID & """>" & objDataReader("SUB_NAME") & "</a>"

objDataReader.Close()
objConnection.Close()

Dim intCatID2 as integer
Dim strSQL3 as string

intCatID2 = DataBinder.Eval(e.Item.DataItem, "CAT_ID")
Dim subnamelabel2 As Label =
CType(e.Item.FindControl("lblsubname2"), Label)

'SQL display details and rating value
strSQL3 = "SELECT * FROM SUBCATEGORY WHERE CAT_ID=" & intCatID2
& " Order by SUB_NAME ASC"

objConnection = New OledbConnection(strConnection)
objCommand = New OledbCommand(strSQL3, objConnection)

objConnection.Open()
objDataReader = objCommand.ExecuteReader()

'Read data
objDataReader.Read()

Dim intSID2 as integer = objDataReader("SUB_ID")

subnamelabel2.text = subnamelabel2.text & "<a class=""dt3"" title=""Go
to " & objDataReader("SUB_NAME") &" Sub-Category""
href=""pageview.aspx?tab=" & 1 & "&catid=" & intCatID2 & "&subid=" &
intSID2 & """>" & objDataReader("SUB_NAME") & "</a>..."

objDataReader.Close()
objConnection.Close()

End if

End Sub
End Class
'++++++++++++++++++++++++++++++++++++++++++++

'++++++++++++++++++++++++++++++++++++++++++++
'Display the alphabetical letter listing in the footer
Public Class Display_Letter_Links

Public Shared Sub Display_Letter_Links()

Dim i as Integer,lblalphaletter
lblalphaletter.Text = string.empty

for i = 65 to 90
lblalphaletter.text = lblalphaletter.text & "<a
href=""pageview.aspx?tab=2&l=" & chr(i) & chr(34) & _
" class=""letter"" title="& chr(i) & ">" & chr(i) & "</a>&nbsp;&nbsp;"
next

End Sub
End Class
'++++++++++++++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++++++++++++++
'Count the total number of links
Public Class Total_Link_Count

Public Shared Sub Total_Link_Count()
dim lbltotalLinks
Dim CmdCount As New OleDbCommand("Select Count(LINK_ID) From
LINKS", New OleDbConnection(strConnection))
CmdCount.Connection.Open()
lbltotalLinks.Text = "There are&nbsp;" &
CmdCount.ExecuteScalar() & "&nbsp;links in&nbsp;"
CmdCount.Connection.Close()

End Sub
End Class
'++++++++++++++++++++++++++++++++++++++++++++

End Module
End Namespace

Mar 29 '06 #1
6 10356
All methods associated with control events should be in your ASPX server
script area or in a separate code-behind file. You cannot put this in a
class library file.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Fossie" <gi*****@ihug.co.nz> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...
Hello,

I'm trying to streamline an app by converting inline code into a
functions.vb file in the App_Code folder but can't seem to work out
this error: The code worked fine in its "inline version".

BC30456: 'LinkCat_ItemDataBound' is not a member of 'ASP.default_aspx

Line 45: <asp:DataList id="LinkCat" RepeatColumns="2"
RepeatDirection="Horizontal" OnItemDataBound="LinkCat_ItemDataBound"
runat="server">

Many thanks in advance.

default.aspx
<%@ Page Language="VB" MasterPageFile="site.master" Debug="True"%>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.Oledb" %>
<%@ import Namespace="System.Configuration" %>

<script runat="server">

'++++++++++++++++++++++++++++++++++++++++++++
'Handle the page load event
Sub Page_Load(Sender As Object, E As EventArgs)
dim Display_Category,Total_Link_Count,Display_Letter_L inks
'Display all categories
Display_Category.Display_Category

'Call Total Link Count - get the number links
Total_Link_Count.Total_Link_Count
'Call risplay link name A to Z
Display_Letter_Links.Display_Letter_Links

Display_Letter_Links.lblletter.Text = "Link Name A-Z:"

End Sub
'++++++++++++++++++++++++++++++++++++++++++++

</script>

functions.vb (in App-Code)

Imports System
Imports System.Data
Imports System.Data.OleDb
Imports Microsoft.VisualBasic

Namespace MyXD
Module myModule
'++++++++++++++++++++++++++++++++++++++++++++
'Declare public so it will accessible in all subs
Public strConnection
Public objConnection
Public objCommand
Public strSQL as string
Public iRandomLink as integer
Public strSubCatName as string
'++++++++++++++++++++++++++++++++++++++++++++

'++++++++++++++++++++++++++++++++++++++++++++
'Database connection string - Open database
Public Class DBconnect

Public Shared Sub DBconnect()

strConnection = ConfigurationSettings.AppSettings("MyXD")

objConnection = New OledbConnection(strConnection)
objCommand = New OledbCommand(strSQL, objConnection)
objConnection.Open()

End Sub
End Class
'++++++++++++++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++++++++++++++
'Display all categories with count
Public Class Display_Category

Public Shared Sub Display_Category()
dim strSQL,lbltotalCat,LinkCat

strSQL = "SELECT *, (SELECT COUNT (*) FROM LINKS WHERE LINKS.CAT_ID =
CATEGORY.CAT_ID AND LINK_APPROVED = 1) AS REC_COUNT FROM CATEGORY ORDER
BY CAT_NAME ASC"

'Call Open database - connect to the database

DBconnect.DBconnect()

Dim LinkAdapter as New OledbDataAdapter(objCommand)
Dim dts as New DataSet()
LinkAdapter.Fill(dts, "CAT_ID")

lbltotalCat.Text = CStr(dts.Tables(0).Rows.Count) &
"&nbsp;categories"

LinkCat.DataSource = dts.Tables("CAT_ID").DefaultView
LinkCat.DataBind()

'Close database connection
objConnection.Close()
End Sub
End Class
'++++++++++++++++++++++++++++++++++++++++++++

'++++++++++++++++++++++++++++++++++++++++++++
'Show an Item in a Bound List - Display sub categories

Public Class LinkCat_ItemDataBound

Public Shared Sub LinkCat_ItemDataBound(sender As Object, e As
DataListItemEventArgs)

'First, make sure we're not dealing with a Header or Footer row
If e.Item.ItemType <> ListItemType.Header AND e.Item.ItemType <>
ListItemType.Footer then

Dim intCatID as integer
Dim strSQL2 as string

intCatID = DataBinder.Eval(e.Item.DataItem, "CAT_ID")

Dim subnamelabel As Label =
CType(e.Item.FindControl("lblsubname"), Label)

'SQL display details and rating value
strSQL2 = "SELECT * FROM SUBCATEGORY WHERE CAT_ID=" & intCatID
& " Order by SUB_NAME DESC"

Dim objDataReader as OledbDataReader

objConnection = New OledbConnection(strConnection)
objCommand = New OledbCommand(strSQL2, objConnection)

objConnection.Open()
objDataReader = objCommand.ExecuteReader()

'Read data
objDataReader.Read()

Dim intSID as integer = objDataReader("SUB_ID")

subnamelabel.text = subnamelabel.text & "<a class=""dt3"" title=""Go to
" & objDataReader("SUB_NAME") &" Sub-Category""
href=""pageview.aspx?tab=" & 1 & "&catid=" & intCatID & "&subid=" &
intSID & """>" & objDataReader("SUB_NAME") & "</a>"

objDataReader.Close()
objConnection.Close()

Dim intCatID2 as integer
Dim strSQL3 as string

intCatID2 = DataBinder.Eval(e.Item.DataItem, "CAT_ID")
Dim subnamelabel2 As Label =
CType(e.Item.FindControl("lblsubname2"), Label)

'SQL display details and rating value
strSQL3 = "SELECT * FROM SUBCATEGORY WHERE CAT_ID=" & intCatID2
& " Order by SUB_NAME ASC"

objConnection = New OledbConnection(strConnection)
objCommand = New OledbCommand(strSQL3, objConnection)

objConnection.Open()
objDataReader = objCommand.ExecuteReader()

'Read data
objDataReader.Read()

Dim intSID2 as integer = objDataReader("SUB_ID")

subnamelabel2.text = subnamelabel2.text & "<a class=""dt3"" title=""Go
to " & objDataReader("SUB_NAME") &" Sub-Category""
href=""pageview.aspx?tab=" & 1 & "&catid=" & intCatID2 & "&subid=" &
intSID2 & """>" & objDataReader("SUB_NAME") & "</a>..."

objDataReader.Close()
objConnection.Close()

End if

End Sub
End Class
'++++++++++++++++++++++++++++++++++++++++++++

'++++++++++++++++++++++++++++++++++++++++++++
'Display the alphabetical letter listing in the footer
Public Class Display_Letter_Links

Public Shared Sub Display_Letter_Links()

Dim i as Integer,lblalphaletter
lblalphaletter.Text = string.empty

for i = 65 to 90
lblalphaletter.text = lblalphaletter.text & "<a
href=""pageview.aspx?tab=2&l=" & chr(i) & chr(34) & _
" class=""letter"" title="& chr(i) & ">" & chr(i) & "</a>&nbsp;&nbsp;"
next

End Sub
End Class
'++++++++++++++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++++++++++++++
'Count the total number of links
Public Class Total_Link_Count

Public Shared Sub Total_Link_Count()
dim lbltotalLinks
Dim CmdCount As New OleDbCommand("Select Count(LINK_ID) From
LINKS", New OleDbConnection(strConnection))
CmdCount.Connection.Open()
lbltotalLinks.Text = "There are&nbsp;" &
CmdCount.ExecuteScalar() & "&nbsp;links in&nbsp;"
CmdCount.Connection.Close()

End Sub
End Class
'++++++++++++++++++++++++++++++++++++++++++++

End Module
End Namespace

Apr 1 '06 #2
A better choice would be to compile functions.vb into functions.dll,
and simply call its methods/properties after placing functions.dll in the /bin directory.


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Christopher Reed" <ca****@nospam.nospam> wrote in message
news:%2******************@TK2MSFTNGP15.phx.gbl...
All methods associated with control events should be in your ASPX server script area or in a
separate code-behind file. You cannot put this in a class library file.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Fossie" <gi*****@ihug.co.nz> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...
Hello,

I'm trying to streamline an app by converting inline code into a
functions.vb file in the App_Code folder but can't seem to work out
this error: The code worked fine in its "inline version".

BC30456: 'LinkCat_ItemDataBound' is not a member of 'ASP.default_aspx

Line 45: <asp:DataList id="LinkCat" RepeatColumns="2"
RepeatDirection="Horizontal" OnItemDataBound="LinkCat_ItemDataBound"
runat="server">

Many thanks in advance.

default.aspx
<%@ Page Language="VB" MasterPageFile="site.master" Debug="True"%>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.Oledb" %>
<%@ import Namespace="System.Configuration" %>

<script runat="server">

'++++++++++++++++++++++++++++++++++++++++++++
'Handle the page load event
Sub Page_Load(Sender As Object, E As EventArgs)
dim Display_Category,Total_Link_Count,Display_Letter_L inks
'Display all categories
Display_Category.Display_Category

'Call Total Link Count - get the number links
Total_Link_Count.Total_Link_Count
'Call risplay link name A to Z
Display_Letter_Links.Display_Letter_Links

Display_Letter_Links.lblletter.Text = "Link Name A-Z:"

End Sub
'++++++++++++++++++++++++++++++++++++++++++++

</script>

functions.vb (in App-Code)

Imports System
Imports System.Data
Imports System.Data.OleDb
Imports Microsoft.VisualBasic

Namespace MyXD
Module myModule
'++++++++++++++++++++++++++++++++++++++++++++
'Declare public so it will accessible in all subs
Public strConnection
Public objConnection
Public objCommand
Public strSQL as string
Public iRandomLink as integer
Public strSubCatName as string
'++++++++++++++++++++++++++++++++++++++++++++

'++++++++++++++++++++++++++++++++++++++++++++
'Database connection string - Open database
Public Class DBconnect

Public Shared Sub DBconnect()

strConnection = ConfigurationSettings.AppSettings("MyXD")

objConnection = New OledbConnection(strConnection)
objCommand = New OledbCommand(strSQL, objConnection)
objConnection.Open()

End Sub
End Class
'++++++++++++++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++++++++++++++
'Display all categories with count
Public Class Display_Category

Public Shared Sub Display_Category()
dim strSQL,lbltotalCat,LinkCat

strSQL = "SELECT *, (SELECT COUNT (*) FROM LINKS WHERE LINKS.CAT_ID =
CATEGORY.CAT_ID AND LINK_APPROVED = 1) AS REC_COUNT FROM CATEGORY ORDER
BY CAT_NAME ASC"

'Call Open database - connect to the database

DBconnect.DBconnect()

Dim LinkAdapter as New OledbDataAdapter(objCommand)
Dim dts as New DataSet()
LinkAdapter.Fill(dts, "CAT_ID")

lbltotalCat.Text = CStr(dts.Tables(0).Rows.Count) &
"&nbsp;categories"

LinkCat.DataSource = dts.Tables("CAT_ID").DefaultView
LinkCat.DataBind()

'Close database connection
objConnection.Close()
End Sub
End Class
'++++++++++++++++++++++++++++++++++++++++++++

'++++++++++++++++++++++++++++++++++++++++++++
'Show an Item in a Bound List - Display sub categories

Public Class LinkCat_ItemDataBound

Public Shared Sub LinkCat_ItemDataBound(sender As Object, e As
DataListItemEventArgs)

'First, make sure we're not dealing with a Header or Footer row
If e.Item.ItemType <> ListItemType.Header AND e.Item.ItemType <>
ListItemType.Footer then

Dim intCatID as integer
Dim strSQL2 as string

intCatID = DataBinder.Eval(e.Item.DataItem, "CAT_ID")

Dim subnamelabel As Label =
CType(e.Item.FindControl("lblsubname"), Label)

'SQL display details and rating value
strSQL2 = "SELECT * FROM SUBCATEGORY WHERE CAT_ID=" & intCatID
& " Order by SUB_NAME DESC"

Dim objDataReader as OledbDataReader

objConnection = New OledbConnection(strConnection)
objCommand = New OledbCommand(strSQL2, objConnection)

objConnection.Open()
objDataReader = objCommand.ExecuteReader()

'Read data
objDataReader.Read()

Dim intSID as integer = objDataReader("SUB_ID")

subnamelabel.text = subnamelabel.text & "<a class=""dt3"" title=""Go to
" & objDataReader("SUB_NAME") &" Sub-Category""
href=""pageview.aspx?tab=" & 1 & "&catid=" & intCatID & "&subid=" &
intSID & """>" & objDataReader("SUB_NAME") & "</a>"

objDataReader.Close()
objConnection.Close()

Dim intCatID2 as integer
Dim strSQL3 as string

intCatID2 = DataBinder.Eval(e.Item.DataItem, "CAT_ID")
Dim subnamelabel2 As Label =
CType(e.Item.FindControl("lblsubname2"), Label)

'SQL display details and rating value
strSQL3 = "SELECT * FROM SUBCATEGORY WHERE CAT_ID=" & intCatID2
& " Order by SUB_NAME ASC"

objConnection = New OledbConnection(strConnection)
objCommand = New OledbCommand(strSQL3, objConnection)

objConnection.Open()
objDataReader = objCommand.ExecuteReader()

'Read data
objDataReader.Read()

Dim intSID2 as integer = objDataReader("SUB_ID")

subnamelabel2.text = subnamelabel2.text & "<a class=""dt3"" title=""Go
to " & objDataReader("SUB_NAME") &" Sub-Category""
href=""pageview.aspx?tab=" & 1 & "&catid=" & intCatID2 & "&subid=" &
intSID2 & """>" & objDataReader("SUB_NAME") & "</a>..."

objDataReader.Close()
objConnection.Close()

End if

End Sub
End Class
'++++++++++++++++++++++++++++++++++++++++++++

'++++++++++++++++++++++++++++++++++++++++++++
'Display the alphabetical letter listing in the footer
Public Class Display_Letter_Links

Public Shared Sub Display_Letter_Links()

Dim i as Integer,lblalphaletter
lblalphaletter.Text = string.empty

for i = 65 to 90
lblalphaletter.text = lblalphaletter.text & "<a
href=""pageview.aspx?tab=2&l=" & chr(i) & chr(34) & _
" class=""letter"" title="& chr(i) & ">" & chr(i) & "</a>&nbsp;&nbsp;"
next

End Sub
End Class
'++++++++++++++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++++++++++++++
'Count the total number of links
Public Class Total_Link_Count

Public Shared Sub Total_Link_Count()
dim lbltotalLinks
Dim CmdCount As New OleDbCommand("Select Count(LINK_ID) From
LINKS", New OleDbConnection(strConnection))
CmdCount.Connection.Open()
lbltotalLinks.Text = "There are&nbsp;" &
CmdCount.ExecuteScalar() & "&nbsp;links in&nbsp;"
CmdCount.Connection.Close()

End Sub
End Class
'++++++++++++++++++++++++++++++++++++++++++++

End Module
End Namespace


Apr 1 '06 #3
I believe the main problem here is that he is trying to call a control event
from his local class library.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:eC*************@TK2MSFTNGP10.phx.gbl...
A better choice would be to compile functions.vb into functions.dll,
and simply call its methods/properties after placing functions.dll in the
/bin directory.

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Christopher Reed" <ca****@nospam.nospam> wrote in message
news:%2******************@TK2MSFTNGP15.phx.gbl...
All methods associated with control events should be in your ASPX server
script area or in a separate code-behind file. You cannot put this in a
class library file.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Fossie" <gi*****@ihug.co.nz> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...
Hello,

I'm trying to streamline an app by converting inline code into a
functions.vb file in the App_Code folder but can't seem to work out
this error: The code worked fine in its "inline version".

BC30456: 'LinkCat_ItemDataBound' is not a member of 'ASP.default_aspx

Line 45: <asp:DataList id="LinkCat" RepeatColumns="2"
RepeatDirection="Horizontal" OnItemDataBound="LinkCat_ItemDataBound"
runat="server">

<snip, snip>
Apr 2 '06 #4
re:
I believe the main problem here is that he is trying to call a control event from his local class
library.
Sure.

re: BC30456: 'LinkCat_ItemDataBound' is not a member of 'ASP.default_aspx
You *can* move a user control to an assembly, and call it from the assembly,
but you'd have to hook it into the current context to be able to use it.

That would introduce unnecessary complexity into what's essentially simple code, though.

In essence, control events need to reside in a Page, or in code which derives from Page.


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Christopher Reed" <ca****@nospam.nospam> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...I believe the main problem here is that he is trying to call a control event from his local class
library.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:eC*************@TK2MSFTNGP10.phx.gbl...
A better choice would be to compile functions.vb into functions.dll,
and simply call its methods/properties after placing functions.dll in the /bin directory.

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Christopher Reed" <ca****@nospam.nospam> wrote in message
news:%2******************@TK2MSFTNGP15.phx.gbl...
All methods associated with control events should be in your ASPX server script area or in a
separate code-behind file. You cannot put this in a class library file.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Fossie" <gi*****@ihug.co.nz> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...
Hello,

I'm trying to streamline an app by converting inline code into a
functions.vb file in the App_Code folder but can't seem to work out
this error: The code worked fine in its "inline version".

BC30456: 'LinkCat_ItemDataBound' is not a member of 'ASP.default_aspx

Line 45: <asp:DataList id="LinkCat" RepeatColumns="2"
RepeatDirection="Horizontal" OnItemDataBound="LinkCat_ItemDataBound"
runat="server">

<snip, snip>

Apr 2 '06 #5
Thanks for your responses - I'm leaving it as inline for the moment -
tried code behind but got the same error.

Apr 3 '06 #6
You dont have the CodeFile attribute in your page directive so ASP.NET
doesnt know where to look for the function..

HTH

Ciaran
"Fossie" <gi*****@ihug.co.nz> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...
Hello,

I'm trying to streamline an app by converting inline code into a
functions.vb file in the App_Code folder but can't seem to work out
this error: The code worked fine in its "inline version".

BC30456: 'LinkCat_ItemDataBound' is not a member of 'ASP.default_aspx

Line 45: <asp:DataList id="LinkCat" RepeatColumns="2"
RepeatDirection="Horizontal" OnItemDataBound="LinkCat_ItemDataBound"
runat="server">

Many thanks in advance.

default.aspx
<%@ Page Language="VB" MasterPageFile="site.master" Debug="True"%>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.Oledb" %>
<%@ import Namespace="System.Configuration" %>

<script runat="server">

'++++++++++++++++++++++++++++++++++++++++++++
'Handle the page load event
Sub Page_Load(Sender As Object, E As EventArgs)
dim Display_Category,Total_Link_Count,Display_Letter_L inks
'Display all categories
Display_Category.Display_Category

'Call Total Link Count - get the number links
Total_Link_Count.Total_Link_Count
'Call risplay link name A to Z
Display_Letter_Links.Display_Letter_Links

Display_Letter_Links.lblletter.Text = "Link Name A-Z:"

End Sub
'++++++++++++++++++++++++++++++++++++++++++++

</script>

functions.vb (in App-Code)

Imports System
Imports System.Data
Imports System.Data.OleDb
Imports Microsoft.VisualBasic

Namespace MyXD
Module myModule
'++++++++++++++++++++++++++++++++++++++++++++
'Declare public so it will accessible in all subs
Public strConnection
Public objConnection
Public objCommand
Public strSQL as string
Public iRandomLink as integer
Public strSubCatName as string
'++++++++++++++++++++++++++++++++++++++++++++

'++++++++++++++++++++++++++++++++++++++++++++
'Database connection string - Open database
Public Class DBconnect

Public Shared Sub DBconnect()

strConnection = ConfigurationSettings.AppSettings("MyXD")

objConnection = New OledbConnection(strConnection)
objCommand = New OledbCommand(strSQL, objConnection)
objConnection.Open()

End Sub
End Class
'++++++++++++++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++++++++++++++
'Display all categories with count
Public Class Display_Category

Public Shared Sub Display_Category()
dim strSQL,lbltotalCat,LinkCat

strSQL = "SELECT *, (SELECT COUNT (*) FROM LINKS WHERE LINKS.CAT_ID =
CATEGORY.CAT_ID AND LINK_APPROVED = 1) AS REC_COUNT FROM CATEGORY ORDER
BY CAT_NAME ASC"

'Call Open database - connect to the database

DBconnect.DBconnect()

Dim LinkAdapter as New OledbDataAdapter(objCommand)
Dim dts as New DataSet()
LinkAdapter.Fill(dts, "CAT_ID")

lbltotalCat.Text = CStr(dts.Tables(0).Rows.Count) &
"&nbsp;categories"

LinkCat.DataSource = dts.Tables("CAT_ID").DefaultView
LinkCat.DataBind()

'Close database connection
objConnection.Close()
End Sub
End Class
'++++++++++++++++++++++++++++++++++++++++++++

'++++++++++++++++++++++++++++++++++++++++++++
'Show an Item in a Bound List - Display sub categories

Public Class LinkCat_ItemDataBound

Public Shared Sub LinkCat_ItemDataBound(sender As Object, e As
DataListItemEventArgs)

'First, make sure we're not dealing with a Header or Footer row
If e.Item.ItemType <> ListItemType.Header AND e.Item.ItemType <>
ListItemType.Footer then

Dim intCatID as integer
Dim strSQL2 as string

intCatID = DataBinder.Eval(e.Item.DataItem, "CAT_ID")

Dim subnamelabel As Label =
CType(e.Item.FindControl("lblsubname"), Label)

'SQL display details and rating value
strSQL2 = "SELECT * FROM SUBCATEGORY WHERE CAT_ID=" & intCatID
& " Order by SUB_NAME DESC"

Dim objDataReader as OledbDataReader

objConnection = New OledbConnection(strConnection)
objCommand = New OledbCommand(strSQL2, objConnection)

objConnection.Open()
objDataReader = objCommand.ExecuteReader()

'Read data
objDataReader.Read()

Dim intSID as integer = objDataReader("SUB_ID")

subnamelabel.text = subnamelabel.text & "<a class=""dt3"" title=""Go to
" & objDataReader("SUB_NAME") &" Sub-Category""
href=""pageview.aspx?tab=" & 1 & "&catid=" & intCatID & "&subid=" &
intSID & """>" & objDataReader("SUB_NAME") & "</a>"

objDataReader.Close()
objConnection.Close()

Dim intCatID2 as integer
Dim strSQL3 as string

intCatID2 = DataBinder.Eval(e.Item.DataItem, "CAT_ID")
Dim subnamelabel2 As Label =
CType(e.Item.FindControl("lblsubname2"), Label)

'SQL display details and rating value
strSQL3 = "SELECT * FROM SUBCATEGORY WHERE CAT_ID=" & intCatID2
& " Order by SUB_NAME ASC"

objConnection = New OledbConnection(strConnection)
objCommand = New OledbCommand(strSQL3, objConnection)

objConnection.Open()
objDataReader = objCommand.ExecuteReader()

'Read data
objDataReader.Read()

Dim intSID2 as integer = objDataReader("SUB_ID")

subnamelabel2.text = subnamelabel2.text & "<a class=""dt3"" title=""Go
to " & objDataReader("SUB_NAME") &" Sub-Category""
href=""pageview.aspx?tab=" & 1 & "&catid=" & intCatID2 & "&subid=" &
intSID2 & """>" & objDataReader("SUB_NAME") & "</a>..."

objDataReader.Close()
objConnection.Close()

End if

End Sub
End Class
'++++++++++++++++++++++++++++++++++++++++++++

'++++++++++++++++++++++++++++++++++++++++++++
'Display the alphabetical letter listing in the footer
Public Class Display_Letter_Links

Public Shared Sub Display_Letter_Links()

Dim i as Integer,lblalphaletter
lblalphaletter.Text = string.empty

for i = 65 to 90
lblalphaletter.text = lblalphaletter.text & "<a
href=""pageview.aspx?tab=2&l=" & chr(i) & chr(34) & _
" class=""letter"" title="& chr(i) & ">" & chr(i) & "</a>&nbsp;&nbsp;"
next

End Sub
End Class
'++++++++++++++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++++++++++++++
'Count the total number of links
Public Class Total_Link_Count

Public Shared Sub Total_Link_Count()
dim lbltotalLinks
Dim CmdCount As New OleDbCommand("Select Count(LINK_ID) From
LINKS", New OleDbConnection(strConnection))
CmdCount.Connection.Open()
lbltotalLinks.Text = "There are&nbsp;" &
CmdCount.ExecuteScalar() & "&nbsp;links in&nbsp;"
CmdCount.Connection.Close()

End Sub
End Class
'++++++++++++++++++++++++++++++++++++++++++++

End Module
End Namespace

Jun 18 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1505
by: Joe Kraft | last post by:
I'm hoping someone can help me out. We're running a website that uses XML/XSLT transformations, VB.Net and an Oracle database. Currently the site cannot support more than 6-7 users at a time...
1
2319
by: Craig Street | last post by:
Hi How do i create a base page in ASP.NET 2.0? I don't want to use master pages as I don't need any visual inheritance. You could do this simply in ASP.NET 1.1 by creating a base page that...
1
2803
by: John | last post by:
Hi, We're in the process of migrating our website from ASP.Net 1.1 to ASP.Net 2 and are getting the following error: BC30560: 'default_aspx' is ambiguous in the namespace 'ASP'. I know that...
10
2412
by: ptass | last post by:
Hi In asp.net 2.0 an aspx files .cs file is a partial class and all works fine, however, I thought I’d be able to create another class file, call it a partial class and have that compile and...
0
8503
by: blackstaronline.net | last post by:
Hi, I'm using .NET V2.0 I have been using un-compiled code behind pages for my .net app using "Src" in the @Page. I randomly get an Initialized Culture error when trying to access the page....
1
6528
by: Mohammed Banat | last post by:
All my pages work just fine on development, but as soon as I publish (deploy), I always get Compiler Error Message: BC30456: 'InitializeCulture' is not a member of 'ASP.default_aspx'. This...
9
2178
by: KenLee | last post by:
I made an application which includes classic asp page and asp.net page. when I tried to redirect from classic asp page to asp.net 2.0 page, it works under my local IIS directory. ex) <a...
2
2013
by: Nalaka | last post by:
Hi, I get the following random error... on a asp.net 2.0 aplication.. running at a hosting company (locally no issues). It seems like this happens only when pageOutputCache is enabled and when the...
2
7180
polymorphic
by: polymorphic | last post by:
I have a javascript function which I am trying to call in an ASP.NET page but I receive the following error: "BC30456: 'FixComboHeight is not a member of 'ASP.default_aspx" Javascript Function:...
0
7039
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7037
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
6895
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5326
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4770
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4476
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1296
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
558
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
176
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.