Welcome Guest Search | Active Topics | Sign In | Register

EO message box - how to disable messageboxbutton Options
CodeMaster
Posted: Wednesday, March 14, 2012 3:25:21 PM
Rank: Advanced Member
Groups: Member

Joined: 10/14/2010
Posts: 19
I use the EO msgbox and display "Yes" and "No" button.

Messagebox in aspx:

<eo:MsgBox runat="server" id="MsgBoxConfirm" HeaderHtml="Confirm...." MinWidth="150" Width="320px" OnButtonClick="MsgConfirm_ButtonClick" .....

Code in aspx.cs:

MsgBoxConfirm.Show("Confirm Include/Exclude", "test message confirmation", null,
new EO.Web.MsgBoxButton("Yes", null, "Include"),
new EO.Web.MsgBoxButton("No", null, "Exclude"));


In MsgConfirm_ButtonClick() ; I use the e.command name and perform database logic. While database trasaction is in progress, the user can again click "Yes" or "No" button as the messagebox stays on the screen; this causes duplicate records in the database. Can we somehow disable the Msgboxbuttons after users click "yes" or "no" button or disable the messagebox itself? I tried to use the msgbox.dispose but it did not help.
Code: C#
eo_support
Posted: Wednesday, March 14, 2012 3:54:35 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

The MsgBox does not offer any direct support for you to do that. It is possible for you to do it with JavaScript, but that is no different than peventing a standard ASP.NET button to be clicked twice, so we would consider this is a generic programing questions and won't be providing the specific here. You can search online and you should be able to find plenty of solution about that.

Thanks!
CodeMaster
Posted: Thursday, March 15, 2012 10:07:00 AM
Rank: Advanced Member
Groups: Member

Joined: 10/14/2010
Posts: 19
Thanks for your quick response.

Actually I have a javascript to disable the msgbox, that did not work. I have also added clientsidehandler on MsgBoxButton but it seems the JS does not fire when I click on msgboxbutton.

JS for Msgbox onbuttonclick:
MsgBoxConfirm.Attributes.Add("OnButtonClick", "Javascript:" + MsgBoxConfirm.ClientID + ".disabled=true;" );

ClientSidehandler on MsgboxButtons:
MsgBoxConfirm.Show("Confirm Include/Exclude", "test message confirmation", null,
new EO.Web.MsgBoxButton("Yes", "on_button_clicked", "Include"),
new EO.Web.MsgBoxButton("No", "on_button_clicked", "Exclude"));

JS :
<script type="text/javascript">
function on_button_clicked()
{
alert("Button is clicked.");
}
</script>
eo_support
Posted: Thursday, March 15, 2012 10:32:35 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
I am sorry but you have to resolve this yourself. There are very obvious mistakes in your code but in order to avoid abuse, we are not in a position to troubleshoot such issues for you. So please seek other resources for this issue. Thanks for understanding.
CodeMaster
Posted: Thursday, March 15, 2012 10:50:04 AM
Rank: Advanced Member
Groups: Member

Joined: 10/14/2010
Posts: 19
Ok. Can you at least show some example that fires javascript on messagebutton click?
eo_support
Posted: Thursday, March 15, 2012 11:23:45 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Please see if this sample helps:

http://demo.essentialobjects.com/Demos/MsgBox/Features/Handling%20Button%20Event%20-%20Client%20Side/Demo.aspx

Alternatively, you can use a Dialog control and place regular ASP.NET controls (such as Images, Labels and Buttons) inside the Dialog control to produce your message box. That way you will have direct access to those buttons and can do anything you would like to do with them.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.