Code Bank: Client-SideMessageBox.zip

File Name: Client-SideMessageBox.zip
File Size: 17,233 bytes
Downloaded: 775 times
Posted by: asktech
Date Posted: Tuesday, September 05, 2006 (CST)
Download File: Click here to download this file

Brief Description
Client side Message Box to ASPX Pages

Full Description

Client side Message Box to ASPX Pages

 

Client Side Dialog is very common practice in developing an application where we need to ask the user for confirmation or display a message.

 

In this article you will find 2 ways how you can do the client side confirmation dialog.

 

You can set the Attributes property of a button for onClick. I wrote a generic function that can take control as a paratament and the message as a nother parameter. Below is a sample code

 

public static void CreateConfirmBox(System.Web.UI.WebControls.Button btn, string strMessage)
{
    btn.Attributes.Add("onclick", "return confirm('" + strMessage + "');");
}

 

In ASP.NET 2.0 Button, LinkButton and Imagebutton controls have an OnClientClick property, which makes displaying a confirmation dialog very easy.

 

<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" OnClientClick="return confirm('Are you sure you want to delete this item?');" Text="Delete ASP.NET 2.0" Width="191px" />

 



Ratings
 

Add Your Comment

Ferotech Solution Services Inc.