2014-09-02 76 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

相關問題