---
title: "inserting data to DB on click of button placed in a  jquery pop-up window"  
description: "inserting data to DB on click of button placed in a  jquery pop-up window"  
author: "Rashmi S"  
published: 2014-12-09  
updated: 2014-12-09  
canonical: https://www.mindstick.com/forum/12772/inserting-data-to-db-on-click-of-button-placed-in-a-jquery-pop-up-window  
category: ".net"  
tags: ["jquery ui"]  
reading_time: 12 minutes  

---

# inserting data to DB on click of button placed in a  jquery pop-up window

hi... I'm creating pop-up window to allow visitors to post their feedbacks. In [master page](https://www.mindstick.com/blog/258/set-property-value-on-master-page-from-content-page), i used DIV tag for [feedback](https://www.mindstick.com/articles/12731/the-importance-of-feedback-to-the-user-experience) GUI, on click of "Feedback" option ,im displaying feedback DIV as a popup window using [jquery dialog](https://www.mindstick.com/forum/12738/submit-page-within-jquery-dialog) method. on click of "Send" button, i wrote code for inserting data to DB. In webform created using masterpage, "Send" [button click](https://www.mindstick.com/forum/790/form-gets-submiited-twice-on-button-click) [event is not triggering](https://www.mindstick.com/forum/159192/chrome-extension-onclick-event-is-not-triggering-an-alert-popup), but in webpage without masterpage , "Send " [button event](https://www.mindstick.com/forum/12660/button-event-handler-not-working) is triggering..\
I want the code to work in childpages...\
Masterpage code:[source code](https://www.mindstick.com/forum/33476/pls-send-me-source-code-for-changing-passward-in-asp-dot-net-i-tried-so-much-from-google-but-its-not-workining):

```
<script type="text/javascript"><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>    <script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/jquery-ui.js" type="text/javascript"></script>    <link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/themes/start/jquery-ui.css"        rel="stylesheet" type="text/css" /> $("[id*=btnPopup]").live("click", function () {        $("#modal_dialog").dialog({            title: "POST FEEDBACK",            width: "600",            modal: true,            buttons: {                Send: function () {                    //$("[id*=Button1]").click();                    $(document.getElementById('<%= Button1.ClientID %>')).click();                },                Close: function () {                    $(this).dialog('close');                }            },            open: function (type, data) { $(this).parent().appendTo("form"); },            close: function (type, data) { $(this).parent().replacewith(""); }        });        return false;    });</script><li><asp:LinkButton ID="btnPopup" runat="server" Text="Feedback">Feedback</asp:LinkButton></li><div id="modal_dialog" style="display: none;width:auto;">                                 <table style="width:100%;">        <tr>            <td align="center">                <strong style="font-size: medium">FEEDBACK</strong></td>        </tr>        <tr>            <td style="height: 30px">                <hr size="3" color="#DA6BB6"/></td>        </tr>        <tr>            <td>                            <table style="width:100%;">                    <tr>                        <td style="width: 117px; font-size: medium; color: #800000;" bgcolor="#F8DDBA">                            Name</td>                        <td>                            <asp:TextBox ID="txtName" runat="server" Width="350px"></asp:TextBox>                        </td>                        <td>                            &nbsp;</td>                    </tr>                    <tr>                        <td style="width: 117px; font-size: medium; color: #800000;" bgcolor="#F8DDBA">                            Email ID</td>                        <td>                            <asp:TextBox ID="txtEmailId" runat="server" Width="350px"></asp:TextBox>                        </td>                        <td>                            &nbsp;</td>                    </tr>                    <tr>                        <td style="width: 117px; font-size: medium; color: #800000;" bgcolor="#F8DDBA">                            Contact Number</td>                        <td>                            <asp:TextBox ID="txtContactNo" runat="server" Width="350px"></asp:TextBox>                        </td>                        <td>                            &nbsp;</td>                    </tr>                    <tr>                        <td style="width: 117px; font-size: medium; color: #800000;" bgcolor="#F8DDBA"                             valign="top">                            Feedback</td>                        <td>                            <asp:TextBox ID="txtFeedback" runat="server" Rows="8" TextMode="MultiLine"                                 Width="350px"></asp:TextBox>                        </td>                        <td>                            &nbsp;</td>                    </tr>                    <tr>                        <td style="width: 117px; font-size: medium; color: #800000;" bgcolor="#F8DDBA">                            &nbsp;</td>                        <td>                            &nbsp;<asp:Button ID="Button1" runat="server" style = "display:none" OnClick = "Button1_Click"                                 Text="Post"  />                        </td>                        <td>                            &nbsp;</td>                    </tr>                </table>                        </td>        </tr>        <tr>            <td>                            &nbsp;</td>        </tr></table></div>protected void Button1_Click(object sender, EventArgs e)        {            if (b.Feedback_Add(txtName.Text, txtEmailId.Text, txtContactNo.Text, txtFeedback.Text, DateTime.Now.ToShortDateString()) == 1)                Response.Write("<script>alert('Feedback sent successfully.')</script>");            else                Response.Write("<script>alert('ERROR in sending feedback.')</script>");            txtContactNo.Text = "";            txtEmailId.Text = "";            txtFeedback.Text = "";            txtName.Text = "";        }
```

\
**This is not working....!****\****Webpage without masterpage:****```
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>    <script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/jquery-ui.js" type="text/javascript"></script>    <link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/themes/start/jquery-ui.css"        rel="stylesheet" type="text/css" /><script type="text/javascript">    $(document).ready(function () {        $("#modal_dialog").dialog({            title: "jQuery Dialog Popup",            width: "600",            modal: true,            buttons: {                Send: function () {                    //$("[id*=Button1]").click();                    $(document.getElementById('<%= Button1.ClientID %>')).click();                },                Close: function () {                    $(this).dialog('close');                }            },            open: function (type, data) { $(this).parent().appendTo("form"); },            close: function (type, data) { $(this).parent().replacewith(""); }        });        return false;    });</script><body>    <form id="form1" runat="server">    <div>       <div id="modal_dialog" style="display: none;width:auto;">                                 <table style="width:100%;">        <tr>            <td align="center">                <strong style="font-size: medium">FEEDBACK</strong></td>        </tr>        <tr>            <td style="height: 30px">                <hr size="3" color="#DA6BB6"/></td>        </tr>        <tr>            <td>                            <table style="width:100%;">                    <tr>                        <td style="width: 117px; font-size: medium; color: #800000;" bgcolor="#F8DDBA">                            Name</td>                        <td>                            <asp:TextBox ID="txtName" runat="server" Width="350px"></asp:TextBox>                        </td>                        <td>                            &nbsp;</td>                    </tr>                    <tr>                        <td style="width: 117px; font-size: medium; color: #800000;" bgcolor="#F8DDBA">                            Email ID</td>                        <td>                            <asp:TextBox ID="txtEmailId" runat="server" Width="350px"></asp:TextBox>                        </td>                        <td>                            &nbsp;</td>                    </tr>                    <tr>                        <td style="width: 117px; font-size: medium; color: #800000;" bgcolor="#F8DDBA">                            Contact Number</td>                        <td>                            <asp:TextBox ID="txtContactNo" runat="server" Width="350px"></asp:TextBox>                        </td>                        <td>                            &nbsp;</td>                    </tr>                    <tr>                        <td style="width: 117px; font-size: medium; color: #800000;" bgcolor="#F8DDBA"                             valign="top">                            Feedback</td>                        <td>                            <asp:TextBox ID="txtFeedback" runat="server" Rows="8" TextMode="MultiLine"                                 Width="350px"></asp:TextBox>                        </td>                        <td>                            &nbsp;</td>                    </tr>                    <tr>                        <td style="width: 117px; font-size: medium; color: #800000;" bgcolor="#F8DDBA">                            &nbsp;</td>                        <td>                            &nbsp;<asp:Button ID="Button1" runat="server" style = "display:none" OnClick = "Button1_Click"                                 Text="Post"  />                        </td>                        <td>                            &nbsp;</td>                    </tr>                </table>                        </td>        </tr>        <tr>            <td>                            &nbsp;</td>        </tr></table>                             </div>    </div>    </form></body>protected void Button1_Click(object sender, EventArgs e)        {            if (b.Feedback_Add(txtName.Text, txtEmailId.Text, txtContactNo.Text, txtFeedback.Text, DateTime.Now.ToShortDateString()) == 1)            {                Response.Write("<script>window.alert('Feedback sent successfully.');window.location='/Visitor/HomePage.aspx';</script>");            }            else            {                Response.Write("<script>window.alert('ERROR in sending feedback.');window.location='/Visitor/HomePage.aspx';</script>");            }            //System.Threading.Thread.Sleep(10000);            txtContactNo.Text = "";            txtEmailId.Text = "";            txtFeedback.Text = "";            txtName.Text = "";            /        }
```**\
This code is working....!\
I want the code to [execute](https://www.mindstick.com/interview/49/how-can-i-execute-a-php-script-using-command-line) in childpagesAny help appreciated..! Thank You...!\


---

Original Source: https://www.mindstick.com/forum/12772/inserting-data-to-db-on-click-of-button-placed-in-a-jquery-pop-up-window

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
