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 asp.net

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">

  .modalBackground

  {

  background-color#CCCCFF;

  filteralpha(opacity=40);

  opacity0.5;

  }

  .ModalWindow

  {

  bordersolid1px#c0c0c0;

  background-color#99ccff;

  padding0px10px10px10px;

  positionabsolute;

  top-1000px;

  }

</style>

ModapPopUp Code

------------------------

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

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

ID="ModalPopupExtender2" runat="server">

</cc1:ModalPopupExtender>

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

<%--Button popup--%>

<center>

<table runat="server">

<tr>

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

  valign="top">

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

  Deletion</div>

  </td>

</tr>

<tr>

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

  <br />

  The Record has been deleted!

  </td>

</tr>

</table>

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

</center>

</asp:Panel>

<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-

<


script>

function

funShow() {

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

}

</

script>



<

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

  PUT YOur control here

</

div>


<

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"
    TargetControlID="LinkButton1"
    PopupControlID="Panel1"
    
    OkControlID="OkButton" 
    OnOkScript="onOk()"
    CancelControlID="CancelButton" 
    PopupDragHandleControlID="Panel3" >
        <Animations>
            <OnShowing> ..  </OnShowing>
            <OnShown>   ..  </OnShown>    
            <OnHiding>  ..  </OnHiding>            
            <OnHidden>  ..  </OnHidden>            
        </Animations>
    </ajaxToolkit:ModalPopupExtender>

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

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

http://theinfiniteloopblog.com/tag/change-javascript-confirm-button-text/
Devil Scorpio replied to prasad vjp on 24-Nov-11 03:09 AM
Hi,

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
http://geekswithblogs.net/dotNETvinz/archive/2010/11/02/a-customize-messagebox-confirmbox-and-framebox-control-for-asp.net.aspx