ASP.NET - add a button in message box - Asked By prasad vjp on 23-Nov-11 01:51 AM

hai friends ,

how to add insert,delete buttons in messagebox in

i know how to create conformation msgbox in java script,but how to place custom button in messagebox

dipa ahuja replied to prasad vjp on 23-Nov-11 01:54 AM
You should use the modalpopupExtender for custom messagebox

CSS Effect


<style type="text/css">
















ModapPopUp Code


<cc1:ModalPopupExtender TargetControlID="Button2" BackgroundCssClass="modalBackground"

CancelControlID="btnMsg" PopupControlID="Panel1" PopupDragHandleControlID="btnMsg"

ID="ModalPopupExtender2" runat="server">


<asp:Panel ID="Panel1" runat="server" CssClass="ModalWindow">

<%--Button popup--%>


<table runat="server">


  <td bgcolor="#cccccc" style="border: 1px; border-color: Black;" height="20px" align="left"


  <div style="border-bottom-width: 1px; border: 1px solid">





  <td align="center" bgcolor="#99ccff">

  <br />

  The Record has been deleted!




<asp:Button ID="btnMsg" runat="server" Text="OK" /><br />



<asp:Button ID="Button2" runat="server" Text="OK" /><br />

Jitendra Faye replied to prasad vjp on 23-Nov-11 01:55 AM
For that use jquery popup, here you can put your custom control also.

if you want to show modal popup then use jquery popup.

after adding jqueryui plugin you can use it.

like this-




funShow() {

$('#dialog).dialog({ resizable: false, height: 140, modal: true });





div id="dialog" title="Basic dialog">

  PUT YOur control here




asp:Button ID="Button1" runat="server" Text="Button" onClientClick="return funShow()" />

Note- This will be closed when you will click on close button,

Try this and let me know.

Riley K replied to prasad vjp on 23-Nov-11 01:56 AM

You could design a Panel where you can place controls like buttons and use a Modal pop extender to display the Panel as popup

<ajaxToolkit:ModalPopupExtender ID="MPE" runat="server"
    PopupDragHandleControlID="Panel3" >
            <OnShowing> ..  </OnShowing>
            <OnShown>   ..  </OnShown>    
            <OnHiding>  ..  </OnHiding>            
            <OnHidden>  ..  </OnHidden>            

Reena Jain replied to prasad vjp on 23-Nov-11 02:06 AM

As I know you can't do that by confirm box. you can not change the default button of confirm box. It's a standard button object. But, you can however script a custom dialog box.

here is a link for this
Devil Scorpio replied to prasad vjp on 24-Nov-11 03:09 AM

Follow these steps to customize message box

1. Download and extract the ProudMonkey.Common.Controls.dll

2. Add the ProudMonkey.Common.Controls.dll and the AjaxControlToolkit.dll in your project solution

3. Right click on the project and select Add Reference

4. Click on the Browse tab and locate the two dlls mentioned in step 2

5. Click OK

6. Register the controls by adding the following lines below at the top most part of your page (ASPX).

Refer the following website for more info