Hi all so i have this lauching the javascript to the page:

Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "confirm('Are you  Sure You Want to Delete User??')", true);

But now i remebered that i need an answer on the codebehinf(C#).
So this way i can do the rest of the code, but im stuck with that, does anybody knows how to do that??

Thanks and Regards

Edited by pritaeas: Moved to ASP.NET.

3 Years
Discussion Span
Last Post by ggamble

A different approach may be more helpful.. For example....
Add an asp:Hidden field in your form, to store the "user is sure" value. Set its default value to false.

Then instead of using your code behind, add your javascript function in the .ASPX file directly.

Modify the function so that if the user clicks on "yes", you update the hidden input element's value to "yes" via javascript.

when the form is submitted, use your btnSubmit_Click() function to check the asp:Hidden value: if that value is true, you know the user has already confirmed the "are you sure" dialog.



But the problem im using a damn radgrid from telerik and using the delete field i have to start everything first fro mteh code behind.


i wish it would be that easy,
but i cant use it because of the radgrid.


Try this:

private void RadGrid_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    if (e.Item is GridDataItem)
        GridDataItem dataItem = e.Item as GridDataItem;
        string contactName = dataItem["SomeField"].Text;

        LinkButton button = dataItem["ColumnName"].Controls[0] as LinkButton;
        button.Attributes["onclick"] = "return confirm('Are you  Sure You Want to Delete User??')";
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.