Jump to content

Recommended Posts

Posted

When I began the programming for http://www.sceptermarkeingtechnologies.com, I quickly noticed that Asp.net does not support the MessageBox class that I was familiar with in windows forms.

 

SinceAsp.net runs on the server it doesn't have access to produce a modaldialog box on the client. However, by using a scripting language thatruns in the clients browser a similar construct is available. Injavascript the window.alert() function will produce a modal dialogsimilar to what you would expect from MessageBox in windows forms.

 

So,I decided to create a static class MessageBox with a static methodShow(), which will give you the ablility to to still use the syntaxMessageBox.Show("Your Message"); and then convert it into thejavascript window.alert("Your Message"); and add the script to the endof the current response stream.

 

I've written a how to on my blog at: http://sceptermt.blogspot.com/2008/02/how-to-create-message-box-class-in-c.html that shows the source code that I used in C# for my web application and details on how it works.

 

Youcould also write overloads for the static show() method to allow theclass to do a javascript confirm() or a prompt(). I haven't needed thatfunctionality yet so I've just kept it simple.

 

More...

 

View All Our Microsoft Related Feeds

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...