JQuery Confirm Box is very simple, which can be customized. We can give manual values for button captions.
The custom box is likk like the pic below.The html page is below
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="JqueryConfirm.aspx.cs"
Inherits="SetCultureSample.JqueryConfirm.JqueryConfirm" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="../Styles/jquery.confirm.css" rel="stylesheet" type="text/css" />
<script src="../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="../Scripts/jquery.confirm.js" type="text/javascript"></script>
<script type="text/javascript">
function ShowConfirm(Title, Message, OkBtnCaption, CancelBtnCaption, ButtonID) {
var elem = $(this).closest('.item');
$.confirm({
'title': Title,
'message': Message,
'buttons': {
OkBtnCaption: {
'class': 'blue',
'action': function () { $('#' + ButtonID).click(); },
'id': 'okBtn'
},
CancelBtnCaption: {
'class': 'gray',
'action': function () { },
'id': 'cancelBtn'
}
}
});
return false;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
</div>
</form>
</body>
</html>
Here we are passing parameters to this method, and ShowConfirm method append the values to the confirm box.
<link href="../Styles/jquery.confirm.css" rel="stylesheet" type="text/css" />
<script src="../Scripts/jquery.confirm.js" type="text/javascript"></script>
<script src="../Scripts/jquery.confirm.js" type="text/javascript"></script>
Here you need to use a stylesheet jquery.confirm.css and a jquery file jquery.confirm.js.
The code behind is
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace SetCultureSample.JqueryConfirm
{
public partial class JqueryConfirm : System.Web.UI.Page
{
/// <summary>
/// Gets or sets the title for.
/// </summary>
/// <value>The title for.</value>
public string TitleFor
{
get;
set;
}
/// <summary>
/// Gets or sets the message.
/// </summary>
/// <value>The message.</value>
public string Message
{
get;
set;
}
/// <summary>
/// Gets or sets the ok button.
/// </summary>
/// <value>The ok button.</value>
public string OkButton
{
get;
set;
}
/// <summary>
/// Gets or sets the cancel button.
/// </summary>
/// <value>The cancel button.</value>
public string CancelButton
{
get;
set;
}
/// <summary>
/// Handles the Load event of the Page control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
protected void Page_Load(object sender, EventArgs e)
{
TitleFor = "Please Confirm";
Message = "Do you agree ?";
OkButton = "bonjour/ok";
CancelButton = "Bon/Cancel";
Button1.Attributes.Add("onclick", "javascript:return ShowConfirm('" + TitleFor + "','" + Message + "','" + OkButton + "','" + CancelButton + "','" + this.Button1.ClientID + "');");
}
/// <summary>
/// Handles the Click event of the Button1 control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
protected void Button1_Click(object sender, EventArgs e)
{
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace SetCultureSample.JqueryConfirm
{
public partial class JqueryConfirm : System.Web.UI.Page
{
/// <summary>
/// Gets or sets the title for.
/// </summary>
/// <value>The title for.</value>
public string TitleFor
{
get;
set;
}
/// <summary>
/// Gets or sets the message.
/// </summary>
/// <value>The message.</value>
public string Message
{
get;
set;
}
/// <summary>
/// Gets or sets the ok button.
/// </summary>
/// <value>The ok button.</value>
public string OkButton
{
get;
set;
}
/// <summary>
/// Gets or sets the cancel button.
/// </summary>
/// <value>The cancel button.</value>
public string CancelButton
{
get;
set;
}
/// <summary>
/// Handles the Load event of the Page control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
protected void Page_Load(object sender, EventArgs e)
{
TitleFor = "Please Confirm";
Message = "Do you agree ?";
OkButton = "bonjour/ok";
CancelButton = "Bon/Cancel";
Button1.Attributes.Add("onclick", "javascript:return ShowConfirm('" + TitleFor + "','" + Message + "','" + OkButton + "','" + CancelButton + "','" + this.Button1.ClientID + "');");
}
/// <summary>
/// Handles the Click event of the Button1 control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
protected void Button1_Click(object sender, EventArgs e)
{
}
}
}
Nice Article..
ReplyDeletethanks for sharing it...
Hey Dude...
ReplyDeleteWhere are those
"jquery.confirm.css" jquery.confirm.js"
Where I can find these files
send me a mail i'll send you back those files, leechrist999@gmail.com
ReplyDeletethanks for very nice tutorial .could you please send files to me ? huseyin_yildiz@msn.com
DeleteNice post, really you have show here very important code for make JQuery confirm box. For learn better you can contact GyanFinder, here any people can get good IT knowledge. GyanFinder is a best place for learn online, it is providing e learning solutions, virtual classroom, online training in india, virtual training so contact to GyanFinder for better knowledge.
ReplyDeleteHello this is awesome blog. You have really did very well in this blog.
ReplyDeleteIt has a lots of information.
Thank You so much.
Online English Speaking Course in India
Wonderful blog.. Thanks for sharing informative blog.. its very useful to me..
ReplyDeletejquery training
Croma campus is best IT training institute and best class IT trainer provides croma campus is great jquery training in noida wiht jo b placement support. croma campus best facilities and lab provides then best option for you join us croma campus
ReplyDeleteThanks for sharing
ReplyDeleteClick Now
Click Now
Click Now
Click Now
Click Now
Click Now
Click Now
Click Now
Click Now
Click Now
For more Information
It is amazing and wonderful to visit your site. Thanks for sharing information; this is useful to us....
ReplyDeleteARTIFICIAL INTELLIGENCE COURSE IN DELHI
FOR MORE INFO:
aşk kitapları
ReplyDeleteyoutube abone satın al
cami avizesi
cami avizeleri
avize cami
no deposit bonus forex 2021
takipçi satın al
takipçi satın al
takipçi satın al
takipcialdim.com/tiktok-takipci-satin-al/
instagram beğeni satın al
instagram beğeni satın al
btcturk
tiktok izlenme satın al
sms onay
youtube izlenme satın al
no deposit bonus forex 2021
tiktok jeton hilesi
tiktok beğeni satın al
binance
takipçi satın al
uc satın al
sms onay
sms onay
tiktok takipçi satın al
tiktok beğeni satın al
twitter takipçi satın al
trend topic satın al
youtube abone satın al
instagram beğeni satın al
tiktok beğeni satın al
twitter takipçi satın al
trend topic satın al
youtube abone satın al
takipcialdim.com/instagram-begeni-satin-al/
perde modelleri
instagram takipçi satın al
instagram takipçi satın al
takipçi satın al
instagram takipçi satın al
betboo
marsbahis
sultanbet
çekmeköy
ReplyDeletekepez
manavgat
milas
balıkesir
P6İİ7K
bayrampaşa
ReplyDeletegüngören
hakkari
izmit
kumluca
4SSBZJ
bayrampaşa
ReplyDeletegüngören
hakkari
izmit
kumluca
İKG
salt likit
ReplyDeletesalt likit
BEVQK
çeşme transfer
ReplyDeletekralbet
bor yağı filtre kağıdı
yağ süzme filtre kağıdı
W5İM8L
شركة تسليك مجاري في خورفكان MhwjsOftjU
ReplyDelete