Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

[4700] A Simple ASP.NET MessageBox Class

Last post 06-13-2008 10:35 AM by rivish84. 22 replies.
Page 1 of 2 (23 items) 1 2 Next >
Sort Posts: Previous Next
  • 01-01-1999 12:00 AM

    [4700] A Simple ASP.NET MessageBox Class

    This thread is for discussions of A Simple ASP.NET MessageBox Class.

    • Post Points: 60
  • Advertisement

    • Red Gate Software

    Advertisement

    Want to boost your .NET application performance?

    Some developers always seem to write efficient and lightening-fast code. What is their secret? It’s ANTS Profiler. “We improved the performance of the application up to 10 times” Dan Ports, Intrigma.

    Try it for yourself now.

  • 07-12-2005 9:25 AM In reply to

    • yhansky
    • Not Ranked
    • Joined on 07-11-2005
    • New Member
    • Points 15

    powerpoint connection

    Hi gud day! can you help me to make a code of visual basic which to open a powerpoint presentation directly. My problem is i have a powerpoint presentation and using a visual basic, when i press a command button it will open the presentation without click the slide show in the editor of powerpoint. thanks
    • Post Points: 0
  • 07-15-2005 4:39 AM In reply to

    • Sheeba
    • Top 500 Contributor
    • Joined on 07-14-2005
    • Member
    • Points 320

    doubt

    Iam  a  beginner Pls  explain me how  to include a  flash  file in  a  HTML page?
    • Post Points: 0
  • 07-23-2005 7:36 AM In reply to

    great article

    A fantastic Article .
    Actually i was looking for such a thing.
    Thanks a lot
    i converted it to VB.net and tried and it works like a charm thanks man
    5/5
    • Post Points: 0
  • 07-23-2005 8:04 AM In reply to

    its firing if i select view in browser but not through internet explorer.how to enable it in ie.
    also if i write alert in some function and i call the alert is firing through the browser.
    why?

    actually javascript is enabled i cannot figure it out why any ideas
    • Post Points: 0
  • 10-11-2005 2:31 PM In reply to

    embed flash file in html

    just use <embed src="abc.swf" width="800" height="553" type="application/x-shockwave-flash">, or whatever its type.
    • Post Points: 0
  • 11-10-2005 6:06 PM In reply to

    • Frank C.
    • Not Ranked
    • Joined on 11-10-2005
    • New Member
    • Points 5

    Messagebox Class

     VasanthKumar,
       Could you please send me a copy of your convertion into VB .net.

    Thanks in advance,
     Frank
     frank.camarillo@cox.net
    • Post Points: 0
  • 11-15-2005 2:31 PM In reply to

    Could you please send me a copy of your convertion into VB .net. :)

    my id is jayabalant_mca@yahoo.co.in
    • Post Points: 0
  • 11-15-2005 2:53 PM In reply to

    • GMike
    • Top 75 Contributor
    • Joined on 08-26-2005
    • Fanatic Member
    • Points 1,155
    ???

    [red]Beer <b>GMike [/red]

    [blue]"I would love to change the world, but they won't give me the source code."[/blue]
    • Post Points: 0
  • 12-09-2005 4:57 PM In reply to

    Message Box VB Code Translation

    Just wondering if A) you could send me the VB translation as well or B) if you could just post it here.

    Thanks!
    blastfemur1970@yahoo.com
    • Post Points: 0
  • 12-10-2005 2:50 AM In reply to

    here the vb.net code

    Code:
    Imports System.Text
    Imports System.Collections.Queue
    Imports System.Web.UI.Page
    Imports System
    Imports System.Web.UI
    Imports System.Web
    Imports System.Collections
    Public Class MessageBox
       Private Shared m_executingPages As Hashtable = New Hashtable

       Private Sub New()
       End Sub

       Public Shared Sub Show(ByVal sMessage As String)
           If Not m_executingPages.Contains(HttpContext.Current.Handler) Then
               Dim executingPage As Page = CType(HttpContext.Current.Handler, Page)
               If Not (executingPage Is Nothing) Then
                   Dim messageQueue As Queue = New Queue
                   messageQueue.Enqueue(sMessage)
                   m_executingPages.Add(HttpContext.Current.Handler, messageQueue)
                   AddHandler executingPage.Unload, AddressOf ExecutingPage_Unload
               End If
           Else
               Dim queue As Queue = CType(m_executingPages(HttpContext.Current.Handler), Queue)
               queue.Enqueue(sMessage)
           End If
       End Sub

       Private Shared Sub ExecutingPage_Unload(ByVal sender As Object, ByVal e As EventArgs)
           Dim queue As Queue = CType(m_executingPages(HttpContext.Current.Handler), Queue)
           If Not (queue Is Nothing) Then
               Dim sb As StringBuilder = New StringBuilder
               Dim iMsgCount As Integer = queue.Count
               sb.Append("<script language='javascript'>")
               Dim sMsg As String
               While System.Math.Max(System.Threading.Interlocked.Decrement(iMsgCount), iMsgCount + 1) > 0
                   sMsg = CType(queue.Dequeue, String)
                   sMsg = sMsg.Replace("" & Microsoft.VisualBasic.Chr(10) & "", "\n")
                   sMsg = sMsg.Replace("""", "'")
                   sb.Append("alert( """ + sMsg + """ );")
               End While
               sb.Append("</script>")
               m_executingPages.Remove(HttpContext.Current.Handler)
               HttpContext.Current.Response.Write(sb.ToString)
           End If
       End Sub
    End Class
    • Post Points: 0
  • 02-04-2006 6:14 AM In reply to

    • Praveena
    • Top 150 Contributor
    • Joined on 09-13-2005
    • Fanatic Member
    • Points 1,265

    Namespace for ConversionHelper

    Hi,

    I have converted it to VB.Net. That code has used a class namely ConversionHelpers.

    What is the namespace to be included for this class.

    Thank u.
    • Post Points: 0
  • 02-04-2006 6:17 AM In reply to

    • Praveena
    • Top 150 Contributor
    • Joined on 09-13-2005
    • Fanatic Member
    • Points 1,265

    Thanks

    Sorry.

    I didnt refer the VB.Net Code posted by Vasanth kumar.

    Thank u Vasanth
    • Post Points: 0
  • 10-14-2006 9:53 AM In reply to

    Re: [4700] A Simple ASP.NET MessageBox Class

    I like the article, it is a nice piece of work.  I don't know if you'd be interested or not but I have used this method in the past to fire an alert dynamically:

    In VB.NET:

    Private Sub MessageBox(ByVal msg As String)

       Dim lbl As New Label()

       lbl.Text =

    "<script language='javascript'>" & Environment.NewLine & _

       "window.alert('" + msg + "')</script>"

       Page.Controls.Add(lbl)

    End Sub

    In C#:

    private void MessageBox(string msg){ 

       Label lbl = new Label();

       lbl.Text =

    "<script language='javascript'>" + Environment.NewLine +

       "window.alert('" + msg + "')</script>";

       Page.Controls.Add(lbl);

    }

    • Post Points: 15
  • 10-27-2006 10:03 AM In reply to

    Re: [4700] A Simple ASP.NET MessageBox Class

    Hi,

    I have copied the code for the MessageBox class but it work properly only if I call the MessageBox.Show(...) method from the Page_Load(...) method, if I call it, for example, from the handler of a button I get the following error:

    Sys.WebForms.PageRequestManagerParserErrorException: The Message received from the server could not be parsed.

    My page use Ajax 1.0 beta (Atlas) and use che ASP.NET 2.0 Wizard class.

    Thanks and SORRY for my english!!

    Stefano

     

    • Post Points: 10
Page 1 of 2 (23 items) 1 2 Next >