?
=?iso-8859-1?B?UultaQ==?=
Hello.
I have just gotten a client-side delete confirmation Javascript button
to work, using this FAQ question as a basis (3rd question down, URL
<http://www.wintellect.com/resources/faqs/default.aspx?faq_id=1&page=5>.
I've no trouble with how this all works, but there's one thing I don't
quite get. In the DataGrid's ItemCreated event, I attach a small bit of
Javascript code to the onClick attribute, via the button's Attributes
collection, as so:
WebControl button = (WebControl) e.Item.Cells[0].Controls[0];
button.Attributes.Add ("onclick", "return confirm (\"Are you
sure?\");");
I understand what this is doing I also handle the DataGrid's Delete
event on the server, in page-behind code. I'm also fine with that.
What I don't get is why my server-side DataGrid Delete event handler is
not called if the onClick Javascript returns false. How and why is this
link made? I'm glad I've got something that works, but I'd much rather
understand *why* it works.
I've looked up the WebControl Attributes property, the Button's clicked
event, and a few MSDN articles that discusses consuming events, but
haven't found any info on this. What gives?
Regards,
Remi.
I have just gotten a client-side delete confirmation Javascript button
to work, using this FAQ question as a basis (3rd question down, URL
<http://www.wintellect.com/resources/faqs/default.aspx?faq_id=1&page=5>.
I've no trouble with how this all works, but there's one thing I don't
quite get. In the DataGrid's ItemCreated event, I attach a small bit of
Javascript code to the onClick attribute, via the button's Attributes
collection, as so:
WebControl button = (WebControl) e.Item.Cells[0].Controls[0];
button.Attributes.Add ("onclick", "return confirm (\"Are you
sure?\");");
I understand what this is doing I also handle the DataGrid's Delete
event on the server, in page-behind code. I'm also fine with that.
What I don't get is why my server-side DataGrid Delete event handler is
not called if the onClick Javascript returns false. How and why is this
link made? I'm glad I've got something that works, but I'd much rather
understand *why* it works.
I've looked up the WebControl Attributes property, the Button's clicked
event, and a few MSDN articles that discusses consuming events, but
haven't found any info on this. What gives?
Regards,
Remi.