Home
Forums
New posts
Search forums
Articles
Latest reviews
Search resources
Members
Current visitors
Newsgroups
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Home
Forums
Newsgroups
Microsoft DotNet
Microsoft ASP .NET
Accessing functions in dlls from code behind
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Karl Seguin, post: 3860768"] If this truly is a utility class, it really shouldn' tinheirt Page... Public Class Functions Public shared Sub SetFocus(ByVal controlClientId As string) Dim ScriptString as String = "<script language='javascript'>document.getElementById('" & controlClientId & "').focus();</script>" ctype(HttpContext.Current.Handler, Page).RegisterStartupScript("setFocus", ScriptString) End Sub End Class notice three things: 1 - I made the function shared...which means you can access it via Functions.SetFocus( 2 - I passed in a string instead of the control (all you are doing with the control is getting the clientId, so why not just pass in the clientId??) 3 - Since I no longer inherit Page, I need to get the current page via HttpContext.Current.Handler alternatively, I could pass the page as a 2nd paramter Karl [/QUOTE]
Verification
Post reply
Home
Forums
Newsgroups
Microsoft DotNet
Microsoft ASP .NET
Accessing functions in dlls from code behind
Top