This is a migrated thread and some comments may be shown as answers.

Javascript confirm error

1 Answer 30 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Madu
Top achievements
Rank 1
Madu asked on 16 Jun 2008, 09:58 AM
hi,
im using asp multiview control with two views. view1 for radgrid for item listing.
view2 for add/edit item detail. i have added,

btnDelete.Attributes.Add("onclick","javascript: return confirm('Are you sure?');")

this method doesnt make a postback event i selected ok from the confirm dialog.
when i make a change to this (found from your forum)

btnDelete.Attributes.Add("onclick","javascript: if(confirm('Are you sure?')!=true return false;")

then it give an javascript error.

when make property change in the button
CauseValidation = "false"
it works fine.

thanks,
madu.

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 18 Jun 2008, 12:47 PM
Hello Madu,

The error in the second expression is caused by a missing bracket. The code below should work as expected:
Button1.Attributes.Add("onclick""javascript: if(confirm('Are you sure?')!=true) return false;"); 
 

Both the first and the second code snippets invoke the Page_Load. I made an example to check this behavior. Please take a look at the attached file.

Greetings,
Daniel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
General Discussions
Asked by
Madu
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or