S
shaun duke
I have been researching this over the last two days without success.
I have a number of ultility functions that I want to make available to
all pages. The pages will all be using code behind so my plan is to
create an assembly CommonFunctions.dll place it in the /bin folder for
the application and import the namespace into the code behind where
required.
Here is an abstract of CommonFunctions.vb
Option Strict Off
Imports System etc etc etc
Namespace CommonFunctions
Public Class Functions
Inherits Page
Public Sub SetFocus(ByVal FocusControl As Control)
Dim ClientID As String = FocusControl.ClientID
Dim ScriptString as String = "<script
language='javascript'>document.getElementById('" & ClientID &
"').focus();</script>"
RegisterStartupScript("setFocus", ScriptString)
End Sub
End Class
End Namespace
This compiles correctly and I have no problem using the SetFocus
function from a aspx with no code behind using
<%@ import Namespace="CommonFunctions" %>
My problem comes when trying to use SetFocus in code behind script.
Even though I import the namespace I get the error BC30451: Name
'SetFocus' is not declared.
Thanks in advance
I have a number of ultility functions that I want to make available to
all pages. The pages will all be using code behind so my plan is to
create an assembly CommonFunctions.dll place it in the /bin folder for
the application and import the namespace into the code behind where
required.
Here is an abstract of CommonFunctions.vb
Option Strict Off
Imports System etc etc etc
Namespace CommonFunctions
Public Class Functions
Inherits Page
Public Sub SetFocus(ByVal FocusControl As Control)
Dim ClientID As String = FocusControl.ClientID
Dim ScriptString as String = "<script
language='javascript'>document.getElementById('" & ClientID &
"').focus();</script>"
RegisterStartupScript("setFocus", ScriptString)
End Sub
End Class
End Namespace
This compiles correctly and I have no problem using the SetFocus
function from a aspx with no code behind using
<%@ import Namespace="CommonFunctions" %>
My problem comes when trying to use SetFocus in code behind script.
Even though I import the namespace I get the error BC30451: Name
'SetFocus' is not declared.
Thanks in advance