473,395 Members | 1,692 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

messagebox in asp.net

hello friends,


can any body give me an example for getting message box in asp.net.i dont know how to get it.plz give me an example .or plz tell me how to use alert in asp.net


regards
venkat3475
Nov 1 '06 #1
2 2285
mdaRock
26
Dear venkat,

I hope this will help you out:

Public Sub UserMsgBox(ByVal sMsg As String, ByVal objPage As System.Web.UI.Page)

Dim sb As New StringBuilder
Dim oFormObject As System.Web.UI.Control

sMsg = sMsg.Replace("'", "\'")
sMsg = sMsg.Replace(Chr(34), "\" & Chr(34))
sMsg = sMsg.Replace(vbCrLf, "\n")
sMsg = "<script language=javascript>alert(""" & sMsg & """)</script>"

sb = New StringBuilder
sb.Append(sMsg)

For Each oFormObject In objPage.Controls
If TypeOf oFormObject Is HtmlForm Then
Exit For
End If
Next

' Add the javascript after the form object so that the
' message doesn't appear on a blank screen.
oFormObject.Controls.AddAt(oFormObject.Controls.Co unt, New LiteralControl(sb.ToString()))

End Sub


hello friends,


can any body give me an example for getting message box in asp.net.i dont know how to get it.plz give me an example .or plz tell me how to use alert in asp.net


regards
venkat3475
Nov 1 '06 #2
mdaRock
26
Dear venkat,

I hope this will help you out:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Public Sub UserMsgBox(ByVal sMsg As String, ByVal objPage As System.Web.UI.Page)
  3.  
  4. Dim sb As New StringBuilder
  5. Dim oFormObject As System.Web.UI.Control
  6.  
  7. sMsg = sMsg.Replace("'", "\'")
  8. sMsg = sMsg.Replace(Chr(34), "\" & Chr(34))
  9. sMsg = sMsg.Replace(vbCrLf, "\n")
  10. sMsg = "<script language=javascript>alert(""" & sMsg & """)</script>"
  11.  
  12. sb = New StringBuilder
  13. sb.Append(sMsg)
  14.  
  15. For Each oFormObject In objPage.Controls
  16. If TypeOf oFormObject Is HtmlForm Then
  17. Exit For
  18. End If
  19. Next
  20.  
  21. ' Add the javascript after the form object so that the 
  22. ' message doesn't appear on a blank screen.
  23. oFormObject.Controls.AddAt(oFormObject.Controls.Co unt, New LiteralControl(sb.ToString()))
  24.  
  25. End Sub
  26.  
  27.  
hello friends,


can any body give me an example for getting message box in asp.net.i dont know how to get it.plz give me an example .or plz tell me how to use alert in asp.net


regards
venkat3475
Nov 1 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Rich Tasker | last post by:
I have a strange situation. A simple call to MessageBox.Show("XXX", "YYY") does not display the message in the messagebox with a visible font. Based on the content of the messagebox, the box...
8
by: Dennis C. Drumm | last post by:
I have ordered the book .NET Framework Solutions, In Search of the Lost Win32 API by John Paul Meuller which I think will help answer some of my questions I have regarding making custom...
2
by: Dennis C. Drumm | last post by:
This is a restatement of an earlier post that evidently wasn't clear. I am building a custom MessageBox dialog that has, among other things, a few new button options (yes to all, no to all, etc.)...
8
by: Saso Zagoranski | last post by:
Hi! I'm trying to make my own MessageBox... What I would like to know is, how the MessageBox class is implemented? I could have something like: new MyMessageBox().ShowDialog(); but I would...
4
by: Tressa | last post by:
I have a messagebox that I only want to pop up only if it is not already being displayed on the screen. My code is still poping up the messagebox even though it is on the screen. What am I doing...
3
by: Sin | last post by:
I'm currently evaluating VC.NET as the new platform for the company I work for and things are looking grim... We're up against another IDE which took me about 5 minutes to master and I've been...
0
by: alex_f_il | last post by:
The class centers MessageBox inside the parent rectangle. Enjoy! using System; using System.Windows.Forms; using System.Text; using System.Drawing; using System.Runtime.InteropServices; ...
20
by: Peter E. Granger | last post by:
I'm having a strange problem (or at least it seems strange to me) trying to display a MessageBox in a VC++ .NET forms application. If I put the call to MessageBox::Show in the form's .h file, it...
10
by: Russ | last post by:
I've been trying to figure out how to show a simple messagebox with an OK button in my web client program (C#). I have looked at every reference to JScript and MessageBox that seemed even remotely...
4
by: Larry Woods | last post by:
I have a Messagebox that looks like: MessageBox.Show("There are pending changes for this patient. Do you want to continue to close?", "Pending Changes", MessageBoxButtons.YesNo,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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
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...
0
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...
0
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...

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.