Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

MsgBox appears where?

Posted on 2006-03-21
5
Medium Priority
?
208 Views
Last Modified: 2011-09-20
Uh....

I'm working in VS2005 on the local development server, and I've just written a server side (VB) msgbox to provide feedback to the user about an error...

and then I realized, I don't know how that's going to work.

Where do msgboxes in custom business objects appear?   Probably at the server?  Because they aren't writing any html to the client?   So, do I have to build a pop-up (or something) into the page dialog, to get the message back to the client?

Any clarification on this would be appreciated.

Thanks!
0
Comment
Question by:codequest
5 Comments
 
LVL 3

Accepted Solution

by:
prajeebkumar earned 680 total points
ID: 16253477
you should probably throw an exception in the custom business object when an error is encountered and your page or UI component can catch that exception and display the error in a pop up or somewhere appropriate in the page, such as a error panel, label or something..
0
 
LVL 12

Assisted Solution

by:bsdotnet
bsdotnet earned 660 total points
ID: 16253556
0
 
LVL 2

Author Comment

by:codequest
ID: 16254210
thanks for the inputs.  I'll take a day or so to check 'em out, and then wrap this up.
0
 
LVL 26

Assisted Solution

by:Rejojohny
Rejojohny earned 660 total points
ID: 16254225
trap the error in ur business object and then u have to use "Page.RegisterClientScriptBlock" to render a clientside (javasript) "alert"  ..

from MSDN
[Visual Basic, C#] The following example demonstrates the use of the RegisterClientScriptBlock method in conjunction with the IsClientScriptBlockRegistered method. If the ECMAScript written in the code-declaration block has not already been registered, as tested by IsClientScriptBlockRegistered, the RegisterClientScriptBlock call is made.
[Visual Basic]
<html>
  <head>
     <script language="VB" runat="server">
    Sub Page_Load( sender as Object,e as EventArgs)
         
       'Form the script that is to be registered at client side.
        Dim scriptString as String = "<script language=JavaScript> function DoClick() {"
        scriptString += "myForm.show.value='Welcome to Microsoft .NET'}<"
        scriptString += "/"
        scriptString += "script>"
     
            If(Not IsClientScriptBlockRegistered("clientScript"))
        RegisterClientScriptBlock("clientScript", scriptString)
        End If
     End Sub
     </script>
  </head>
  <body topmargin="20" leftmargin="10">
     <form id="myForm" runat="server">
        <input type="text" id="show" style="width=200">
      <input type="button" value="ClickMe" onclick="DoClick()">
     </form>
  </body>
</html>
[C#]
<html>
  <head>
    <script language="C#" runat="server">

     public void Page_Load(Object sender, EventArgs e) {

       // Form the script that is to be registered at client side.
       String scriptString = "<script language=JavaScript> function DoClick() {";
       scriptString += "myForm.show.value='Welcome to Microsoft .NET'}<";
       scriptString += "/";
       scriptString += "script>";

           if(!this.IsClientScriptBlockRegistered("clientScript"))
              this.RegisterClientScriptBlock("clientScript", scriptString);
     }

     </script>
  </head>
  <body topmargin="20" leftmargin="10">
     <form id="myForm" runat="server">
        <input type="text" id="show" style="width=200"> <input type="button" value="ClickMe" onclick="DoClick()">
     </form>
  </body>
</html>
0
 
LVL 2

Author Comment

by:codequest
ID: 16364058
I didn't do all the math, but these are good staring points...I'm going to wrap it up.
Thanks!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Integration Management Part 2
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question