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
Deepak Goyal
NA
64
0
How to use confirm function of java script
Jun 5 2009 12:05 PM
Hi
I am trying this with Asp .net web application
I am trying to write some javascript for a confirmation dialog before inserting data into database.
Script is as below
<script type="text/javascript">
function showconfirm()
{
var r=confirm("Press a button");
if (r==true)
{
}
else
{
}
}
</script>
To call showconfirm() function I use
OnClientClick ="showconfirm()"
My button look like as follows.
asp:Button ID="Insert" runat="server" Text="Insert" OnClientClick ="showconfirm()" />
I am using code behind technique. Now here if I don't use
OnClick="Insert_Click"
then I will not able to insert the data.
And if I use
OnClick="Insert_Click"
I will be inserting data every time wether I am clicking
OK
or
cancle
in confirmation dialog
.
I am not able to understand where i should use
OnClick="Insert_Click"
event so that on
OK
click I should be able to insert data and on
cancle
it should not insert data.
So this problem comes when button tag is like this
<asp:Button ID="Insert" runat="server" Text="Insert" OnClientClick="showconfirm()" OnClick="Insert_Click" />
Please suggest some thing.
Reply
Answers (
3
)
How can i Avoid Timeout for Long data entry form.
Multiple workstation app