Jquery windows doesn't appears in ASP.NET Webforms C# RRS feed

  • Question

  • Hello, could you please help me with this and sorry if this is not the correct thread.

    I'm working on an ASP.NET WebForms project and need to perform CRUD operations from one of the webforms, the client wants to show a modal popup confirmation dialog every time a user wants to performs an operation over the database or just when the user wants to exit the webForm, so I' decided to use jQuery to create the modal popup confirmation dialog, the problem is: I need six confirmation windows(CRUD+search+close window) and I won't repeat the same javascript code six times for a confirmation window but different message so I' created this function that receives the title, the message and the button as parameters

    var _confirm = false;
             function Confirm(str, strtitle, button) {
                 if (!strtitle) strtitle = 'Mensaje de error';
                     autoOpen: true,
                     draggable: false,
                     resizable: false,
                     modal: true,
                     title: strtitle,
                     width: 350,
                     height: 180,
                     show: "slide",
                     hide: "puff",
                     buttons: {
                         "No": function () {
                         "Yes": function () {
                             //__doPostBack(button, '')
                             _confirm = true;
                     close: function () {
                 return _confirm

    the ASP.NET button is

    <asp:button id="Button2" onclick="btnDGV_Click" onclientclick="Confirm('Desea eliminar el registro', 'Confirmacion', this);" runat="server" text="Eliminar Registro">

    and the method btnDGV_Click on the server side will perform the action, but in this case it only shows a message that confirms the action

    protected void btnDGV_Click(object sender, EventArgs e)
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Registro eliminado exitosamente !!!')", true);
    my problem is that the jQuery modal windows appears and disappears on a blink of an eye and all of a sudden the message from the server side appears, could you please tell me where is my problem? I'm pretty sure it must be related to the jQuery but I couldn't managed to find the failure


    • Edited by pabletoreto Friday, January 15, 2016 3:00 PM
    • Moved by CoolDadTx Friday, January 15, 2016 3:10 PM ASP.NET related
    Friday, January 15, 2016 2:50 PM

All replies

  • Please post questions related to ASP.NET in the ASP.NET forums (http://forums.asp.net ).
    • Proposed as answer by Just Karl Friday, January 15, 2016 10:27 PM
    Friday, January 15, 2016 3:10 PM