How do i get Confirm popup in C# asp.net ?

Posted by Mahe under ASP.NET on 1/10/2013 | Points: 10 | Views : 45954 | Status : [Member] | Replies : 11
Hi,

How do i get Confirm popup in C# asp.net ?

Thanks&Regards,
Mahe




Responses

Posted by: Ankitsrist on: 1/10/2013 [Member] Starter | Points: 25

Up
0
Down
u can use this in button click event
onClientClick="return confirm('Are you sure you want to delete?')";

mark this if it helps u



Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Self-Innovator on: 1/10/2013 [Member] Bronze | Points: 25

Up
0
Down

try this
  protected void btnAdd_Click(object sender, EventArgs e)

{
ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Add button clicked');", true);
}


Join Hands Change lives
Thanks & Regards
Straight Edge Society

Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ankitsrist on: 1/10/2013 [Member] Starter | Points: 25

Up
0
Down
check this link also http://www.dotnetfunda.com/forums/thread5124-confirm-message-box-in-aspnet.aspx



Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ranjeet_8 on: 1/10/2013 [Member] [MVP] Gold | Points: 25

Up
0
Down
Hi,
you can use AJAX ConfirmButton Extender control.
Look at this url :
http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/ConfirmButton/ConfirmButton.aspx

Please Mark As Answer if this helps you

.

Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mahe on: 1/10/2013 [Member] Starter | Points: 25

Up
0
Down
Hi,

Thanks for your reply.

How do i check whether the user has clicked "Ok" or "Cancel" button,
based on which i need to perform different function.

Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: muralikrishnasurap-12704 on: 1/10/2013 [Member] Starter | Points: 25

Up
0
Down
Hi Mahe,

onClientClick="return confirm('Are you sure you want to delete?')";

above confirm returns a bool value based on user selection you can make use of that....in other way if you are using .aspx(page) button event will not post back to server when user select the no.



Best Regards
Murali Krishna.S

Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ankitsrist on: 1/10/2013 [Member] Starter | Points: 25

Up
0
Down
hey mahe,
u can check this by simply write Response.Redirect("welcome.aspx") in button click event handler in aspx.cs page and write onClientClick="return confirm('Are you sure you want to Redirect to new page?')"; as i mentioned above in .aspx button after OnClick="btnsign_Click"; and u will find if u click on ok of confirm box u will automaticaly redirect to the page as u have mentioned in response.redirect...nd if u cancel u will remain in the same page...check it out

mark if this helps u

Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: perfectchourasia-9163 on: 1/10/2013 [Member] Starter | Points: 25

Up
0
Down
btnDelete.Attributes.Add("Onclick", "return confirm('Are You Sure to Delete this Claim?')")

You can also visit my http://sandeep-chourasia.blogspot.in for more details and solution of asp.net.

ER sandeep chourasia
sandeepchrs@yahoo.com (on facebook)
http://www.aspnetcodes.com/

Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Saclines on: 8/26/2014 [Member] Starter | Points: 25

Up
0
Down
Use OnClientClick event of the LinkButton and use Confirm method of javascript

- See more at: http://www.dotnetlines.com/forum/tabid/86/forumid/6/threadid/271/scope/posts/Default.aspx

Sachin N. S.

Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sandeepmhatre on: 8/27/2014 [Member] Starter | Points: 25

Up
0
Down
Hi,

Please go though this link, Link shows detail of how to show window popup in asp.net

http://sandeepmhatre.blogspot.com/2012/07/javascript-to-open-popup-on-hyperlink.html

Sandeep M,
Software Developer
Follow me on :
http://sandeepmhatre.blogspot.in

Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Naveenhcl on: 9/3/2014 [Member] Starter | Points: 25

Up
0
Down
Hi,

Using Javascript you can achieve this.

Refer below sample code
<asp:Button ID="btnReviewed" runat="server" Text="Reviewed"  CssClass="btncontrol"
OnClientClick="return confirm('Are you sure want to change as Reviewed ?');"
onclick="btnReviewed_Click" />


Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response