Hi, when I click on the cancel button on the javascript confirm dialog, it does do a postback.
The problem is that the file is just a (.cs), so I can't use the "
.
Creating Remove button and javascript confirm:
Creating message:
I hope somebody can help me.
Thanks.
The problem is that the file is just a (.cs), so I can't use the "
return
args.set_cancel(
true
);" argument in de aspx file.
.
Creating Remove button and javascript confirm:
// Remove
rtb =
new
RadToolBarButton();
rtb.CommandName =
"Remove"
;
rtb.Text =
""
;
rtb.ImageUrl =
"~/Images/actiontoolbar/actiontoolbar_remove.png"
;
rtb.DisabledImageUrl =
"~/Images/actiontoolbar/actiontoolbar_remove_grayed.png"
;
rtb.CausesValidation =
false
;
rtb.Attributes.Add(
"onclick"
,
"javascript: if (!confirmDelete()) return false;"
);
radtoolbar.Items.Add(rtb);
Creating message:
/// <summary>
/// Shows a conformation dialog when deleting. On by default.
/// </summary>
[DefaultValue(
true
)]
public
bool
ConfirmDelete
{
get
{
return
(
bool
)(
this
.ViewState[
"ConfirmDelete"
] ??
true
);
}
set
{
this
.ViewState[
"ConfirmDelete"
] = value;
}
}
/// <summary>
/// Shows this message in a conformation dialog when deleting ans ConfirmDelete is on. On by default.
/// </summary>
[DefaultValue(
"Are you sure you want to delete this record?"
)]
public
string
ConfirmDeleteMessage
{
get
{
return
(
string
)(
this
.ViewState[
"ConfirmDeleteMessage"
] ??
"Are you sure you want to delete this record?"
);
}
set
{
this
.ViewState[
"ConfirmDeleteMessage"
] = value;
}
}
protected
override
void
OnLoad(EventArgs e)
{
base
.OnLoad(e);
RadScriptManager.RegisterClientScriptBlock(Page, GetType(),
"confirmdelete"
, @
"function confirmDelete(){return confirm('"
+ ConfirmDeleteMessage +
"');}"
,
true
);
}
I hope somebody can help me.
Thanks.