-
Mar 28th, 2006, 04:43 AM
#1
Dynamic Alert/MessageBox
Run this code from any code behind event to invoke a alert/msgbox without having to use Page.RegisterStartupScript() or using an objects .Attributes property to tie an js alert to it.
This is independant from any object and just like having a VB6/VB.NET Messagebox.
VB Code:
Protected Sub SomeSub(ByVal sender As Object, ByVal e As System.EventArgs)
Response.Write("<script language=javascript>alert('This is a dynamic alert.');</script>") '
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
-
Mar 28th, 2006, 08:24 AM
#2
Re: Dynamic Alert/MessageBox
Edit
Dude, not a good idea.
Response.Write is not a good thing to use on ASP.NET pages.
-
Mar 28th, 2006, 08:48 AM
#3
Re: Dynamic Alert/MessageBox
Then how would you recomend invoking a alert without having to use a hidden control or something?
Say if you wanted to evaluate a couple of aspx controls and depending on the scenerio, call a message?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
-
Nov 9th, 2006, 07:07 PM
#4
Re: Dynamic Alert/MessageBox
Originally Posted by RobDog888
Then how would you recomend invoking a alert without having to use a hidden control or something?
Say if you wanted to evaluate a couple of aspx controls and depending on the scenerio, call a message?
By using Page.RegisterStartupScript.
-
Nov 12th, 2006, 03:00 PM
#5
Re: Dynamic Alert/MessageBox
Yes, I learned that one a while ago as it was a question froggy couldnt answer when I was just starting to learn asp.net.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
-
Nov 15th, 2006, 10:15 PM
#6
Registered User
Re: Dynamic Alert/MessageBox
Originally Posted by mendhak
Edit
Dude, not a good idea.
Response.Write is not a good thing to use on ASP.NET pages.
then what else do u use to display anything on the page from the code-behind?
-
Nov 15th, 2006, 11:05 PM
#7
Re: Dynamic Alert/MessageBox
Hes means to use other methods like - Me.Page.RegisterStartupScript(...
or ...
Me.Page.RegisterClientScriptBlock(...
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
-
Nov 15th, 2006, 11:27 PM
#8
Registered User
Re: Dynamic Alert/MessageBox
ahh ok, so for registering javascripts...
not exactly just trying to display Hello, World! on the page..
Cool, thanks for clearing that up
-
Nov 15th, 2006, 11:36 PM
#9
Re: Dynamic Alert/MessageBox
VB Code:
Me.Page.RegisterStartupScript("script1", "<script language='JavaScript' type='text/javascript'>alert('Hello World');</script>")
No need for js in the html.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|