When the user clicks a certain LinkButton, I need to open a confirmation dialog with OK/Cancel. If the user hits OK, then I need to run a function from ASP.NET (something to update the database).
Something like the following…
Javascript
function openConfirm() {
return window.confirm("Are you sure you want to do this?");
}
ASP
<asp:LinkButton runat="server" CommandName="viewPart" onClick="if(openConfirm() === true) <% SomeASPFunctionCall() %>;">
Delete
</asp:LinkButton>
The catch is that my application is running ASP.NET 1.1, so any references to adding an OnClientClick to the control is irrelevant (because OnClientClick has been added for ASP 2.0). I have tried postbacks via __doPostBack and the __eventObject and __eventArguments, but those simply do not work or I can’t figure it out.
How should I manage this combination of client-side/server-side interaction?
Thank you
your linkButton has no ID, are you sure?
put an ID to it, let’s imagine it’s called
myLinkButton(don’t use this id please 😀 )in the
Page_PreRenderput this code:it’s pseudo code but should build and work also in .NET 1.1 I think, I am not using it since ages…
Edit: inside your grid, in the ItemDataBound or RowDataBound event depending on Framework and Grid version… put something like this: