btAdd click事件在添加记录后打开两个窗口

btnAdd click event opens two window after record added

本文关键字:窗口 两个 事件 click 添加 加记录 btAdd      更新时间:2023-12-19

i正在使用以下代码打开窗口(search.aspx)。我在search.aspx中添加了按钮当我插入btAddclick事件中的记录时,它会打开另一个窗口。插入记录后,我必须关闭那个窗口。我怎么能那样做。

       //calling Search.aspx on button click of abc.aspx
      if (window.showModalDialog) {
        window.showModalDialog("Search.aspx","name",
        "dialogWidth:255px;dialogHeight:250px");
        }
        //Search.aspx code behind
        protected void btnAdd_Click(object sender, EventArgs e)
        {
          //Insert query for adding record
        }
//Search.aspx code
$(document).ready(function ()
        {
            $("input[id$='btnAdd']").live('click', function (e)
            {
                if ($(".csstablelisttdselected").length == 0)
                {
                    alert("Select patient to fixed appointment.");
                    return false;
                }
                else
                {
                    hidPID.value = $('table td.csstablelisttdselected:first').text();                   
                }
            });
        });
    <asp:Button ID="btnAdd" Width="110px" CssClass="cssbutton" runat="server" Text="Add"
                    OnClick="btnAdd_Click" />   

只需在模式窗口中将其放入<HEAD>

<BASE target="_self">