>>>If I uncomment btnDelete part I get JavaScript confirm dialog, but regardless on the answer in doesn't delete.
>>>
>>>Without the dialog it deletes great.
>>>
>>>Do you see what's wrong here?
>>
>>What does your imagebutton tag look like in the ASPX page? Is the OnClick attribute set to anything?
>
>I'm thinking the problem is related to the fact, that this is AJAX application.
>
>So, I should not return confirm, but only return false if confirm returns false.
>
>Here is how I tried to fix my code, but now I'm getting a JavaScript error:
>
>missing ) after condition
>
http://localhost:3432/FCAdmin/AddUsers/Default.aspx>Line 1
>
>And this is my current code:
>
>btnDelete.Attributes.Add("onClick",
> "if (not confirm('Do you want to delete " +
> e.Row.DataItem.ToString() + "?' )) return false;");
>
>Do you see what's wrong here?
>
>Thanks in advance.
With the help of my colleague we fixed the problem with the following:
btnDelete.Attributes.Add("onClick",
"var ch=confirm('Do you want to delete " +
e.Row.DataItem.ToString() + "?');if(ch==false) return false;");
If it's not broken, fix it until it is.
My Blog