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
Bhavesh Vankar
760
1.1k
88.2k
Confirm Message in web asp.net c#
Dec 30 2020 10:15 AM
i have written below code to confirm message before save record into database. but when i impliment inside my project its not working.
Javascript code written into my web page after after head tag.
i have used (!ispostback) in side my project kindly help me what is wrong. the page is not do any process after button press.
<script type=
"text/javascript"
>
function
ConfirmMessage() {
var
selectedvalue = confirm(
"Do you want to save data?"
);
if
(selectedvalue) {
document.getElementById(
'<%=txtconformmessageValue.ClientID %>'
).value =
"Yes"
;
}
else
{
document.getElementById(
'<%=txtconformmessageValue.ClientID %>'
).value =
"No"
;
}
}
</script>
added hidden field for the store value.
<asp:HiddenField ID=
"txtconformmessageValue"
runat=
"server"
/>
code behind code for save button code.
if
(txtconformmessageValue.Value ==
"Yes"
)
{
Page.ClientScript.RegisterStartupScript(
this
.GetType(),
"Confirm value"
,
"alert('Record Has Been Saved')"
,
true
);
}
else
{
return
;
//Page.ClientScript.RegisterStartupScript(this.GetType(), "Confirm value", "alert('You have clicked on CANCEL.')", true);
}
Reply
Answers (
9
)
Data transfer via bluetooth in C#
How to catch multiple exceptions at once