GridView通过JQuery Modal Popup失去焦点

时间:2018-09-10 20:11:18

标签: c# jquery

我有一个gridview,单击链接打开一个JQuery Modal Popup。当我这样做时,该信息在弹出窗口中是正确的,但问题是在弹出窗口关闭后,Gridview不再显示数据,也不刷新。我已经尝试过使用UpdatePanel,但这都不起作用。

    <asp:GridView ID="GridView1" DataKeyNames="EventListID" ShowHeader="false" OnRowCommand="GridView1_RowCommand"  OnRowDataBound="GridView1_RowDataBound" OnDataBound="GridView1_DataBound" runat="server" AutoGenerateColumns="false">
            <Columns>
                <asp:BoundField DataField="MHour" />
                <asp:TemplateField>
                <ItemTemplate>
                        <asp:LinkButton ID="TRStartLink" CommandName="Select" CommandArgument='<%# Eval("EventLocation") +","+Eval("EventListID") + ","+Eval("TRStart") + "," +Eval("EventDate") %>' Text='<%# Eval("TRStart") %>' runat="server" /> 
                </ItemTemplate>
                </asp:TemplateField>            
                <asp:BoundField DataField="EventSubject" ItemStyle-Width="250px" />
                <asp:BoundField DataField="TRStart" />
                <asp:BoundField DataField="EventStart" />
                <asp:BoundField DataField="EventEnd" />
            </Columns>
    </asp:GridView>

    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Select")
        {
           //get data from database
        }

        StringBuilder sb = new StringBuilder();
        sb.Append("$(function() { ");
        sb.Append("$('#dialog').dialog({");
        sb.Append("appendTo: 'form',");
        sb.Append("modal:true,");
        sb.Append("height:300,");
        sb.Append("width:400");
        sb.Append("});");
        sb.Append("return false;");
        sb.Append("});");
        Page.ClientScript.RegisterStartupScript(typeof(Page), "myscript", sb.ToString(), true);

  }
  <div id="dialog" style="display:none;background-color:lavender;height:700px;width:400px;left:0;right:0;margin:0 auto;">    
        //show data from database
    </div>

0 个答案:

没有答案