2017-02-14 1 views
0

Ich habe eine Gridview und eine Zeile Befehlsereignis für die GridView. Ich habe eine footable-Klasse auf die Gridview angewendet. Problem ist, dass, wenn ich auf die Schaltfläche Ergebnisse anzeigen in der GridView klicke, das rowcommand -Ereignis ausgelöst wird und dann der Footable-Style nicht mehr gilt, d. H. Es wird zu einer normalen Gridview beim Seitenpostback. Wie behebe ich das?Footable Stil funktioniert nicht auf Postback

 $(function() { 
     debugger; 
     $('[id*=grdMain]').footable(); 
    });  

<asp:GridView ID="grdMain" runat="server" AllowPaging="false" PageSize="3" AutoGenerateColumns="false" OnRowCreated="grdMain_onRowCreated" 
        CssClass="footable" Width="100%" EmptyDataText="No Records" OnRowCommand="GridView1_rowcommand" > 
        <Columns> 
         <asp:BoundField DataField="ChargeItem" HeaderText="ORDER NAME" ReadOnly="true" HeaderStyle-Width="25%" 
          ItemStyle-Width="25%" /> 
         <asp:BoundField DataField="DateOfVisit" HeaderText="DATE OF SERVICE" ReadOnly="true" 
          HeaderStyle-Width="20%" ItemStyle-Width="20%" /> 
         <asp:BoundField DataField="DoctorName" HeaderText="DOCTOR" ReadOnly="true" HeaderStyle-Width="20%" 
          ItemStyle-Width="20%" /> 
         <asp:BoundField DataField="EncounterOrderId" HeaderText="EncounterOrderId" ReadOnly="true" 
          HeaderStyle-Width="25%" ItemStyle-Width="25%" Visible="false" /> 
         <asp:TemplateField> 
          <HeaderTemplate> 
           Actions 
          </HeaderTemplate> 
          <ItemTemplate> 
           <asp:Button CssClass="btn btn-info" ID="btnresults" runat="server" Text="Results" 
            CommandName="RESULT" CommandArgument='<%#Eval("EncounterOrderId")%>' /></ItemTemplate> 
         </asp:TemplateField> 
        </Columns> 
        <EmptyDataRowStyle ForeColor="Blue" /> 
        <EmptyDataTemplate> 
         <asp:Label runat="server" ID="lblEmptyRecord" Text="No Encounters available"></asp:Label></EmptyDataTemplate> 
        <PagerStyle HorizontalAlign="Center" /> 
        <PagerSettings Mode="NumericFirstLast" PageButtonCount="4" FirstPageText="First" 
         LastPageText="Last" /> 
       </asp:GridView> 




protected void GridView1_rowcommand(object sender, GridViewCommandEventArgs e) 
    { 
     try 
     { 
      if (e.CommandName.Equals("RESULT")) 
      { 
       if (e.CommandArgument != "") 
       { 
        string[] commandArgs = e.CommandArgument.ToString().Split(new char[] { ',' }); 
        int EncounterOrderId = Convert.ToInt32(commandArgs[0]); 
        hdn_EncounterOrderId.Value = Convert.ToString(EncounterOrderId); 

        Button btnConfirm = (Button)e.CommandSource; 
        GridViewRow gvRow = (GridViewRow)btnConfirm.NamingContainer; 
        //Page.ClientScript.RegisterStartupScript(this.GetType(), "ModalScript", "<script type=\"text/JavaScript\" language=\"javascript\">ModalScript(" + EncounterOrderId + ");</script>"); 
       } 
      } 

     } 
     catch (Exception ex) 
     { 
      Elmah.ErrorSignal.FromCurrentContext().Raise(ex); 
     } 
    } 

Antwort

Verwandte Themen