TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Raja
NA
2k
358.6k
How to Show yes/no alert box use c# after buttonclick result
Jan 24 2018 6:29 AM
ASPX
<script type =
"text/javascript"
>
function
Confirm() {
var
confirm_value = document.createElement(
"INPUT"
);
confirm_value.type =
"hidden"
;
confirm_value.name =
"confirm_value"
;
if
(confirm(
"Do you want to save data?"
)) {
confirm_value.value =
"Yes"
;
}
else
{
confirm_value.value =
"No"
;
}
document.forms[0].appendChild(confirm_value);
}
</script>
Code Behind
protected
bool
ValidateDuplicate()
{
bool
result =
true
;
Material material =
new
Material();
MaterialDataAccess materialDA =
new
MaterialDataAccess();
if
(hfdMode.Value.Equals(
"new"
) || hfdMode.Value.Equals(
"draft"
))
{
material.Type =
"N"
;
}
else
if
(hfdMode.Value ==
"update"
)
{
material.Type =
"U"
;
}
material.RequestNo = hfRequestNo.Value;
material.Description = tbxShortDescription.Text.ToUpper().Replace(
"'"
,
"''"
);
materialDA.Material = material;
materialDA.ValidateCheck();
if
(!materialDA.Message.Text.Equals(
"SUCCESS"
))
{
ClientScript.RegisterStartupScript(
typeof
(Page),
"Confirm"
,
"<script type='text/javascript'>callConfirm();</script>"
);
string
confirmValue = Request.Form[
"confirm_value"
];
if
(confirmValue ==
"Yes"
)
{
// event occures
}
else
{
// do nothing
}
}
return
result;
}
I have used above function in inside the button clicl after the success message come continue our further process if not come success to show the popup with yes/no if click no process is stop click no stop the process.but the above code the script is show after the process is completes how to do it?
Reply
Answers (
2
)
I need a sample web pages for multiple page linked with code
ASP.net on ISS web page design