Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 14th, 2005, 02:06 PM
Authorized User
 
Join Date: Jun 2005
Posts: 32
Thanks: 0
Thanked 1 Time in 1 Post
Default How to use MessageBox

   i am a beginner.How to use massage box in asp.net?Why it cannot recognize the syntax?

    int MessageBox(
     HWND hWnd,
     LPCTSTR lpText,
     LPCTSTR lpCaption,
     UINT uType
                  );



 
Old June 14th, 2005, 02:40 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

ASP.NET code runs on the server so you can't use a messagebox (as the messagebox would appear on the server and thus be of no use to user at the other end of the browser).

You need to emit javascript to the HTML stream that calls the "alert" method at the client.

-Peter
 
Old June 14th, 2005, 11:32 PM
Authorized User
 
Join Date: Jun 2005
Posts: 32
Thanks: 0
Thanked 1 Time in 1 Post
Default

Thanks planoie.So how to emit the script and do it?Can you give me an example?

 
Old June 15th, 2005, 12:47 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

check out this link
http://www.tek-tips.com/viewthread.c...1076731&page=1

 
Old June 15th, 2005, 09:24 AM
Authorized User
 
Join Date: Jun 2005
Posts: 32
Thanks: 0
Thanked 1 Time in 1 Post
Default

Don't understand...I need more precise..help!!

 
Old June 15th, 2005, 10:40 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

You need to have the following show up in your HTML:

<script language="javascript">alert("my message");</script>

How you get that onto the page is up to you based on where you intend to use the alert dialog.

-Peter
 
Old June 17th, 2005, 10:20 AM
Authorized User
 
Join Date: Jun 2005
Posts: 32
Thanks: 0
Thanked 1 Time in 1 Post
Default

I have undersand the usage of the message box at the server side.Thank you.Since I am willing to make if for the client side,the following is my coding.But why it is not functioning?Is it my computer is the server while running the ASP.net and thus I can't see the messagebox that should appearat the client side.If so what can I do?

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="asian.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
   <title>WebForm1</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
   <script type="text/javascript">
    function confirmDelete(){
     var x=("Are you sure want to do this?");
        if(x){ return true; } else{ alert("Delete cancelled"); return false; } }

   </script>
</HEAD>
<body MS_POSITIONING="GridLayout">
    <form id="Form1" method="post" runat="server">


<asp:label id="lbl1" style="Z-INDEX: 101; LEFT: 19px; POSITION: absolute; TOP: 18px" runat="server"
        Height="19px" Width="160px">Enter Your Name</asp:label><asp:textbox id="txtName" style="Z-INDEX: 102; LEFT: 24px; POSITION: absolute; TOP: 56px" runat="server"

Width="216px" MaxLength="30"></asp:textbox><asp:label id="lbl2" style="Z-INDEX: 103; LEFT: 24px; POSITION: absolute; TOP: 104px" runat="server"

Height="32px" Width="224px"></asp:label><asp:button id="ok" style="Z-INDEX: 104; LEFT: 40px; POSITION: absolute; TOP: 176px" runat="server"

Width="80px" Text="ok"></asp:button><asp:button id="BtnExit" style="Z-INDEX: 105; LEFT: 168px; POSITION: absolute; TOP: 176px" runat="server"

Height="24px" Width="112px" Text="Exit" CausesValidation="False"></asp:button></form>
    </body>
</HTML>


 
Old June 17th, 2005, 10:21 AM
Authorized User
 
Join Date: Jun 2005
Posts: 32
Thanks: 0
Thanked 1 Time in 1 Post
Default


    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        BtnExit.Attributes.Add("onclick", "return confirmDelete();")

    End Sub






Similar Threads
Thread Thread Starter Forum Replies Last Post
MessageBox help Barkils C# 1 July 16th, 2007 09:30 PM
MessageBox Lalit Pradhan ASP.NET 2.0 Professional 1 July 5th, 2006 12:03 PM
MessageBox Ric_H General .NET 2 April 19th, 2006 01:45 PM
Messagebox mh VB.NET 27 March 31st, 2005 01:41 PM
MessageBox asbayani ASP.NET 1.0 and 1.1 Basics 3 July 29th, 2003 03:02 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.