473,667 Members | 2,530 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using Page.RegisterSt artupScript in Class

I have this method on many of my pages. I would like to move it to a Class
as a static method so I can access it in all my pages. However, the page
namespace is only available in the code behind files. It it possible to do
this? (And please do not tell me how bad it is to use a popup, thanks)

private void UserMessage(str ing Message, bool Popup)

{
StatusMessage.T ext=Message;

ShowMessage.Vis ible=true;

if (Popup)

{

Page.RegisterSt artupScript("St atusMessage","< SCRIPT
LANGUAGE=\"Java Script\">alert( '"+ Message +"');</Script>");

}

}

Thanks for you help!

Earl
Nov 18 '05 #1
2 5977
((System.Web.UI .Page) HttpContext.Cur rent.Handler).R egisterStartupS cript(...

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Earl Teigrob" <ea******@hotma il.com> wrote in message
news:u8******** ******@TK2MSFTN GP10.phx.gbl...
I have this method on many of my pages. I would like to move it to a Class
as a static method so I can access it in all my pages. However, the page
namespace is only available in the code behind files. It it possible to do
this? (And please do not tell me how bad it is to use a popup, thanks)

private void UserMessage(str ing Message, bool Popup)

{
StatusMessage.T ext=Message;

ShowMessage.Vis ible=true;

if (Popup)

{

Page.RegisterSt artupScript("St atusMessage","< SCRIPT
LANGUAGE=\"Java Script\">alert( '"+ Message +"');</Script>");

}

}

Thanks for you help!

Earl

Nov 18 '05 #2
Thanks, Kevin, Thats what I needed.

"Kevin Spencer" <ke***@takempis .com> wrote in message
news:eH******** ******@TK2MSFTN GP11.phx.gbl...
((System.Web.UI .Page) HttpContext.Cur rent.Handler).R egisterStartupS cript(...
--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Earl Teigrob" <ea******@hotma il.com> wrote in message
news:u8******** ******@TK2MSFTN GP10.phx.gbl...
I have this method on many of my pages. I would like to move it to a Class as a static method so I can access it in all my pages. However, the page
namespace is only available in the code behind files. It it possible to do this? (And please do not tell me how bad it is to use a popup, thanks)

private void UserMessage(str ing Message, bool Popup)

{
StatusMessage.T ext=Message;

ShowMessage.Vis ible=true;

if (Popup)

{

Page.RegisterSt artupScript("St atusMessage","< SCRIPT
LANGUAGE=\"Java Script\">alert( '"+ Message +"');</Script>");

}

}

Thanks for you help!

Earl


Nov 18 '05 #3

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

Similar topics

0
3809
by: Leslie McGann | last post by:
Hi, I need to open a different pdf file in an iframe each time the user clicks a button. I also need to open the pdf to a specific page each time. The pdfs in question are located on a web site/virtual directory on a different server. I'm using the RegisterStartupScript function to perform a redirect to the new pdf the first time the page is loaded and each time this button is clicked. The problem is that the pdf document only...
2
6243
by: Matthew Louden | last post by:
how to show the message box in ASP.NET? I try MessageBox.Show, but not work.
5
10066
by: Earl Teigrob | last post by:
I am creating an application where I would like to give web designers the ablity to create a static html page and dyanamically load it into my application(exactly like loading a user control into a page). Is there an easy way to do this or do I need to stream the html into my application and parse unwanted header/footer info before rendering it within the application page (as a literal control, i imagine) Has anyone done this or seen any...
3
1622
by: veera | last post by:
Is it possible to give control focus using Asp.net code??
2
2841
by: Brian Bischof | last post by:
I'm trying to add javascript to a page so that it gets executed when the page opens. I also need to do this during runtime b/c the javascript will change each time. In MSDN I saw that you can make the <Body> tag a server side object and then add an attribute to it. Example: <Body Id="Body1" runat="server"> in VB.NET Body1.Attributes.Add(...)
5
1235
by: Alexander Widera | last post by:
I have a file "file1.cs" with a method: using System; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public static void justdoit() { string script = "<script language=\"JavaScript\"> alert("it works");
3
1732
by: thechaosengine | last post by:
Hi all, I need to be able to cause the following chain of events after clicking an asp:button but I don't know how to do it. I'd really appreciate any advice on this or alternative approaches: The window in question is a popup asking the user to provide some details. The primary window is still open in the background 1. Button on popup clicked
5
1627
by: Dave | last post by:
I have an app with several web forms. Code for each of the forms contains a subroutine I wrote that performs the Javascript function "alert". Thus: Private Sub DisplayAlert(ByVal msg As String) Dim sKey As String = "s" Dim alertScript As String = "<script language=JavaScript runat=server> " alertScript &= "alert('" & msg & "');" alertScript &= "</script>" RegisterClientScriptBlock(sKey, alertScript) End Sub
4
3317
by: Jon Paal | last post by:
"Page.Clientscript" does not compile in assembly, with the error message "Reference to a non-shared member requires an object reference". ... what reference is it looking for ?????? class class1 public sub showimg() Dim Response As HttpResponse = HttpContext.Current.Response Dim theImage As New object
0
8788
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8563
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8646
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7390
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6203
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5675
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4200
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2013
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.