2014-09-02 80 views
0

我有一个ajax模式弹出式扩展器,我用它来显示一些数据的网格视图。看来,之前的数据绑定到GridView ModalPopup弹出:Ajax ModalPopUp扩展在执行之前的代码之前弹出的代码

protected void grdrequisitionraisedbyme_RowCommand(object sender, GridViewCommandEventArgs e) 
    { 
    if (e.CommandName.Equals("viewhistory")) 
     { 
      GridViewRow clickedRow = ((LinkButton)e.CommandSource).NamingContainer as GridViewRow; 
      LinkButton lnkclaimno = (LinkButton)clickedRow.FindControl("lnkclaimno"); 
      DataSet ds = new DataSet(); 
      ds = GetHistory(lnkclaimno.Text.Trim()); 
      grvcapexhistory.DataSource = null; 
      grvcapexhistory.DataBind(); 
      if (ds.Tables[0].Rows.Count > 0) 
      { 
       grvcapexhistory.DataSource = ds.Tables[0]; 
       grvcapexhistory.DataBind(); 
       popup.Show(); 
      } 
      } 

    } 

我放在哪里grvcapexhistory被绑定,但弹出已弹出,即使有断点NOTREACHED popup.Show()

<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="always"> 
     <Triggers> 
      <asp:AsyncPostBackTrigger ControlID="btnrefresh" /> 
      <asp:AsyncPostBackTrigger ControlID="grdrequisitionraisedbyme" /> 
     </Triggers> 
     <ContentTemplate> 
      <div style="height: 300px; overflow-y: scroll;"> 
       <asp:GridView ID="grdrequisitionraisedbyme" runat="server" CssClass="tabledata" OnRowCommand="grdrequisitionraisedbyme_RowCommand"> 
        <Columns> 
         <asp:TemplateField HeaderText="Capex/Po No"> 
          <ItemTemplate> 
           <asp:LinkButton ID="lnkclaimno" runat="server" ForeColor="#3366FF" Text='<%# Eval("CapexNo") %>' 
            CommandName="select"></asp:LinkButton> 
          </ItemTemplate> 
         </asp:TemplateField> 
         <asp:TemplateField HeaderText="View History"> 
          <ItemTemplate> 
           <asp:LinkButton ID="lnkviewhistory" runat="server" CommandName="viewhistory" ForeColor="#3366FF" 
            Text="View History"></asp:LinkButton> 
          </ItemTemplate> 
         </asp:TemplateField> 
        </Columns> 
       </asp:GridView> 
      </div> 
      <br /> 
      <br /> 
      </div> 
      <asp:Panel ID="pnlAddEdit" runat="server" CssClass="modalPopup" Style="display: none"> 
       <asp:Label Font-Bold="true" ID="Label4" runat="server" Text="Customer Details"></asp:Label> 
       <br /> 
       <table align="center"> 
        <tr> 
         <td colspan="6"> 
         <asp:GridView ID="grvcapexhistory" runat="server" CssClass="tabledata"> 
      </asp:GridView> 

         </td> 
        </tr> 
        <tr> 
         <td> 
         </td> 
         <td> 
          <asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClientClick="return Hidepopup()" /> 

         </td> 
        </tr> 
       </table> 
      </asp:Panel> 
      <asp:LinkButton ID="lnkFake" runat="server"></asp:LinkButton> 
      <asp:ModalPopupExtender ID="popup" runat="server" DropShadow="false" PopupControlID="pnlAddEdit" 
       TargetControlID="lnkFake" BackgroundCssClass="modalBackground"> 
      </asp:ModalPopupExtender> 
     </ContentTemplate> 

    </asp:UpdatePanel> 

回答

1

调试器摆脱Ajax弹出窗口并使用下面的内容。它会解决你的问题。

<asp:Panel ID="popup" runat="server" visible="false"> 
<table style="position: fixed; z-index: 1; left: 0px; top: 0px" border="0" width="100%" height="100%"> 
    <tr> 
     <td valign="top" align="center" > 
     // below div will automatically expand as much as needed 
     <div class="yourmodalclass" style=" display:inline-block;margin-top:90px; ">   
     //put your GridView ID="grvcapexhistory" and other stuff here 
</div> 
</td> 
</table> 
</asp:Panel> 

无论何时使用popup.Visible = true显示此弹出窗口;

在弹出的窗口中放一个按钮。 onclick = popup.Visible = false;

此弹出窗口将为您提供完全控制,无需任何回发问题。

您可以在这里看到这些内容起作用:http://atldunia.com/youtube/Zpopup.aspx

+0

这是迄今为止最简单的模式弹出我也碰到过这么远。 我还没用过它。稍后我会将其标记为答案。 +1 – Arbaaz 2014-09-09 04:27:31

相关问题