I am developing a web application that utilises multiple
grids, panels, validation controls etc on the same page.
I have added the appropriate code to pop up dialogs to
confirm delete in datagrids using the ItemCreated event,
template colums and the Button.Attributes.Add
("onclick", "return confirm('Are you sure you wish to
delete this row?');"). This works fine in some instances
when you click on the delete button but not always.
I would also like to add multiple buttons in each row of
the datagrid with other confirmation messages. I have got
this to work but have the same problem that the
confirmation messages art not always displayed.
I have done extensive research into this and find that if
you have validation controls on the same page as a
datagrid or multiple datagrids on the same page using the
above delete methodolgy it is a known limitation (see
http://www.dotnet247.com/247referenc.../9/47917.aspx).
This article talks about using code similar to the code
below to get around the problem but does not go into any
detail.
---------------------------------------------------------
Let's suppose that your onsubmit event handler is named
MyOnSubmit().
Add the following onload event handler to your page:
var VSSubmit
function OnLoad() {
VSSubmit = __doPostBack;
__doPostBack = OnSubmit;
}
This saves a reference to __doPostBack in VSSubmit and
substitutes the
original reference with a reference to our own OnSubmit
handler, which has
the same signature as doPostBack:
function OnSubmit(eventTarget, eventArgument) {
MyOnSubmit();
VSSubmit(eventTarget, eventArgument);
}
This function calls your event handler before calling
__doPostBack via the
reference that we stored before.
This works perfectly on all relatively recent browsers,
including NS4.7
---------------------------------------------------------
Can anyone point me in the right direction to resolve my
problem?
TIA