hi... i'm really new in asp.net, coming from desktop c#. Many of my application has confirmation provided by Class MessageBox, and i wanna know if there is in ASP.net something easy2use like this:
if (MessageBox.Show("Are you certain","title",MessageBox.Button.YESNO) == DialogResult.YES)
{
// myCode 4 YES
}
else
{
// myCode 4 NO
}
Check out this http://www.w3schools.com/js/js_popup.asp
this provides me a confim dialog, but i want to use a "yes/no" answer to decided what to do. how to use those javascript inside "onclicks" of my buttons?
In ToolBox and a new Tab. Right click on it go to Choose items, From the next dialog box browse and select the dll file you just download. Click OK. It will add all The Ajaxcontrol toolkit control into your ToolBox.
Kindly mark this post as "Answer", if it helped you.
one more... ok.. if i click OK (like YES) the block for button_click goes on... and if i click cancel (Like NO), there's someplace to do a code for "cancel" ??
Like, i have a label that will receive the result of operation (if user click yes/ok) and want to place a "user canceled" at this label when user clicks "no/cancel"
<script language="javascript" type="text/javascript">
function utb()
{
document.forms['Form1'].elements['tb'].value = "You have cancelled the operation";
}
</script>
Kindly mark this post as "Answer", if it helped you.
ofernandosea...
0 Points
13 Posts
get confirmation
Apr 16, 2012 02:40 PM|LINK
hi... i'm really new in asp.net, coming from desktop c#. Many of my application has confirmation provided by Class MessageBox, and i wanna know if there is in ASP.net something easy2use like this:
if (MessageBox.Show("Are you certain","title",MessageBox.Button.YESNO) == DialogResult.YES) { // myCode 4 YES } else { // myCode 4 NO }balagopinath
Member
169 Points
41 Posts
Re: get confirmation
Apr 16, 2012 02:43 PM|LINK
Hi
I assumes you want to do this on client site.
Check out this http://www.w3schools.com/js/js_popup.asp
basheerkal
Star
10672 Points
2426 Posts
Re: get confirmation
Apr 16, 2012 03:04 PM|LINK
You may use Ajax TooKit ConfirmButtonExtender like this.
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Submit" /> <asp:ConfirmButtonExtender ID="Button1_ConfirmButtonExtender" runat="server" ConfirmOnFormSubmit="True" ConfirmText="Do You really want to proceed?" Enabled="True" TargetControlID="Button1"> </asp:ConfirmButtonExtender>(Talk less..Work more)
ofernandosea...
0 Points
13 Posts
Re: get confirmation
Apr 16, 2012 03:05 PM|LINK
this provides me a confim dialog, but i want to use a "yes/no" answer to decided what to do. how to use those javascript inside "onclicks" of my buttons?
ofernandosea...
0 Points
13 Posts
Re: get confirmation
Apr 16, 2012 03:10 PM|LINK
How exactly i start to use this? i'm @ VS2010 ultimate
Update: already found @ codeplex.com ...
Update2: how to "Import/using" ? i've already added as reference
basheerkal
Star
10672 Points
2426 Posts
Re: get confirmation
Apr 16, 2012 03:36 PM|LINK
Download The latest AjaxControltooKit.dll
In ToolBox and a new Tab. Right click on it go to Choose items, From the next dialog box browse and select the dll file you just download. Click OK. It will add all The Ajaxcontrol toolkit control into your ToolBox.
(Talk less..Work more)
ofernandosea...
0 Points
13 Posts
Re: get confirmation
Apr 16, 2012 04:20 PM|LINK
one more... ok.. if i click OK (like YES) the block for button_click goes on... and if i click cancel (Like NO), there's someplace to do a code for "cancel" ??
Like, i have a label that will receive the result of operation (if user click yes/ok) and want to place a "user canceled" at this label when user clicks "no/cancel"
basheerkal
Star
10672 Points
2426 Posts
Re: get confirmation
Apr 16, 2012 04:34 PM|LINK
For ConfirButtonExtender there is property onclientcancel, You can specify a client side script/javascrpt to do something.
(Talk less..Work more)
ZeeshanAnsar...
Participant
878 Points
264 Posts
Re: get confirmation
Apr 16, 2012 04:42 PM|LINK
better to use javascript
confirm() box which is written as
var yesno = confirm("Are you sure you want to proceed?"); if(yesno == true) { //code for proceed } else { // stop to proceed }Please 'Mark as Answer' if this post helps you.
basheerkal
Star
10672 Points
2426 Posts
Re: get confirmation
Apr 16, 2012 05:01 PM|LINK
You can Do something Like this.
In form
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Submit" /> <asp:ConfirmButtonExtender ID="Button1_ConfirmButtonExtender" runat="server" ConfirmText="Do You really want to proceed?" Enabled="True" TargetControlID="Button1" onclientcancel="utb"></asp:ConfirmButtonExtender> <br /> <asp:TextBox ID="tb" runat="server" Height="16px" Width="290px"></asp:TextBox>Within Head Tag
<script language="javascript" type="text/javascript"> function utb() { document.forms['Form1'].elements['tb'].value = "You have cancelled the operation"; } </script>(Talk less..Work more)