I have gridview within update pannel and on RowCommand I want to Call a method ExportToExcel();
Button Id =btnExcelPreview
but due to Update Pannel Not Working.
-------------------------------Aspx page:
<asp:UpdatePanel ID="UpdatePanel11" runat="server"> <ContentTemplate> <fieldset> <legend>Search</legend> <div class="row"> <div class="col-sm-3"> From Date <asp:TextBox ID="txtFromdt" onKeyDown="preventBackspace();" runat="server" AutoComplete="off"></asp:TextBox> <ajaxToolkit:CalendarExtender ID="cefromDate" PopupButtonID="txtFromdt" runat="server" TargetControlID="txtFromdt" Format="dd/MM/yyyy"> </ajaxToolkit:CalendarExtender> </div>
<div class="col-sm-3"> To Date <asp:TextBox ID="txtTodt" onKeyDown="preventBackspace();" runat="server" AutoComplete="off"></asp:TextBox> <ajaxToolkit:CalendarExtender ID="CeTodate" PopupButtonID="txtTodt" runat="server" TargetControlID="txtTodt" Format="dd/MM/yyyy"> </ajaxToolkit:CalendarExtender> </div>
<div class="col-sm-3"> Branch: <asp:DropDownList ID="ddlBranch" runat="server" Width="100%"></asp:DropDownList> </div> </div> <div class="row"> <div class="col-sm-3"> Department <asp:DropDownList ID="ddlDept" runat="server"></asp:DropDownList> </div> <div class="col-sm-3"> Commodity <asp:DropDownList ID="ddlCommodity" runat="server"></asp:DropDownList> </div> <div class="col-sm-3"> Test Report No.. <asp:TextBox ID="txtS_WorkOrder" runat="server" Width="100%"></asp:TextBox>
</div> <div class="col-sm-1"> <asp:LinkButton ID="btnSearch" runat="server" class="btn btn-success btn-xs" OnClick="btnSearch_Click"><i class="fa fa-search"></i> Search</asp:LinkButton> </div> <div class="col-sm-1"> <asp:LinkButton ID="btnClear" runat="server" Text="Clear" class="btn btn-danger btn-xs btn-block" OnClick="btnClear_Click"><i class="fa fa-refresh"></i> Clear</asp:LinkButton> </div> </div> </div> <div class="row"> <div class="col-sm-8"> </div> <div class="col-sm-4 text-right"> <div style="padding-right: 21px;"> Page Size <asp:DropDownList ID="ddlpageSize" runat="server" Width="70" AutoPostBack="true" OnSelectedIndexChanged="ddlpageSize_SelectedIndexChanged"> <asp:ListItem Value="50" Text="50"></asp:ListItem> <asp:ListItem Value="100" Text="100"></asp:ListItem> <asp:ListItem Value="150" Text="150"></asp:ListItem> <asp:ListItem Value="200" Text="200"></asp:ListItem> </asp:DropDownList> </div> </div> </div> </fieldset> <%--<div class="row"> <div class="col-sm-12 scrolling-table-container">--%> <div style="overflow: hidden;" id="DivHeaderRow"> </div> <div style="overflow: scroll;" onscroll="OnScrollDiv(this)" id="DivMainContent"> <asp:HiddenField ID="hidFrontOfficeID" runat="server" Value="0" /> <asp:HiddenField ID="hidLabID" runat="server" Value="0" /> <asp:GridView ID="grdFrontOfficeWorksheet" runat="server" AutoGenerateColumns="False" CssClass="table-grid" PageSize="10" AllowPaging="false" OnRowCommand="grdFrontOfficeWorksheet_RowCommand" OnRowDataBound="grdFrontOfficeWorksheet_RowDataBound" OnPageIndexChanging="grdFrontOfficeWorksheet_PageIndexChanging"> <PagerStyle CssClass = "table table-striped table-bordered table-hover" /> <Columns> <asp:TemplateField HeaderText="TRF Ref.No."> <HeaderStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-1" /> <ItemStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-1" /> <ItemTemplate> <asp:Label ID="lblTRFRefNo" runat="server" Text='<%#Eval("TRFRefNo") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Test Report No."> <HeaderStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-1" /> <ItemStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-1" /> <ItemTemplate> <asp:Label ID="lblTestReportNo" runat="server" Text='<%#Eval("TestReportNo") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Report Date"> <HeaderStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-1" /> <ItemStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-1" /> <ItemTemplate> <asp:Label ID="lblReportDate" runat="server" Text='<%#Eval("ReportDate") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Department"> <HeaderStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-1" /> <ItemStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-1" /> <ItemTemplate> <asp:Label ID="lblDepartment" runat="server" Text='<%#Eval("DivisionName") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Customer"> <HeaderStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-1" /> <ItemStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-1" /> <ItemTemplate> <asp:Label ID="lblCustomerAddress" runat="server" Text='<%#Eval("CustomerAddress") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Customer Ref."> <HeaderStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-1" /> <ItemStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-1" /> <ItemTemplate> <asp:Label ID="lblCustomerRef" runat="server" Text='<%#Eval("CustomerRef") %>'></asp:Label> </ItemTemplate> </asp:TemplateField>
<asp:TemplateField HeaderText="Customer Ref.Date"> <HeaderStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-1" /> <ItemStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-1" /> <ItemTemplate> <asp:Label ID="lblCustomerRefDate" runat="server" Text='<%#Eval("CustomerRefDate") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Sample Particulars"> <HeaderStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-1" /> <ItemStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-1" /> <ItemTemplate> <asp:Label ID="lblSampleParticulars" runat="server" Text='<%#Eval("SampleParticulars") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Sample Receipt Date"> <HeaderStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-1" /> <ItemStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-1" /> <ItemTemplate> <asp:Label ID="lblSampleReceiptDate" runat="server" Text='<%#Eval("SampleReceiptDate") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="No. Of Sample"> <HeaderStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-1" /> <ItemStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-1" /> <ItemTemplate> <asp:Label ID="lblSampleNo" runat="server" Text='<%#Eval("SampleNo") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Sample Description"> <HeaderStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-1" /> <ItemStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-1" /> <ItemTemplate> <asp:Label ID="lblSampleDescription" runat="server" Text='<%#Eval("SampleDescription") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Condition Of Sample"> <HeaderStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-1" /> <ItemStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-1" /> <ItemTemplate> <asp:Label ID="lblSampleCondition" runat="server" Text='<%#Eval("SampleCondition") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Sample Code" Visible="false"> <HeaderStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-1" /> <ItemStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-1" /> <ItemTemplate> <asp:Label ID="lblSampleCode" runat="server" Text='<%#Eval("SampleCode") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="ViewSampleDetails" Visible="false"> <HeaderStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-1" /> <ItemStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-1" /> <ItemTemplate> <asp:Button ID="btnViewSampleDetails" runat="server" Text="View Details" CommandName="ViewSample" CommandArgument='<%#Eval("FrontOfficeID")+";" +Eval("LabID") %>' /> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Hide Logo"> <HeaderStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-2" /> <ItemStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-1" /> <ItemTemplate> <asp:CheckBox ID="chkLogo" runat="server" /> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="With Sign"> <HeaderStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-2" /> <ItemStyle HorizontalAlign="Center" Wrap="False" CssClass="col-sm-1" /> <ItemTemplate> <asp:CheckBox ID="chkWithSign" runat="server" /> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Preview"> <ItemStyle HorizontalAlign="Center" CssClass="col-sm-1" /> <ItemTemplate> <asp:ImageButton ID="btnPreview" runat="server" ImageUrl="~/App_Themes/Images/pdf-icon.png" CommandArgument='<%#Eval("FrontOfficeID")+";"+ Eval("LabID")+";"+ Eval("TestReportNo")+";"+ Eval("SampleCodeId")+";"+ Eval("Division")+";"+ Eval("Commodity")%>' CommandName="Preview" Width="25" Height="25" /> <asp:ImageButton ID="btnExcelPreview" runat="server" ImageUrl="~/App_Themes/Images/ExcelIcon.png" CommandArgument='<%#Eval("FrontOfficeID")+";"+ Eval("LabID")+";"+ Eval("TestReportNo")%>' CommandName="ExportToExcel" Width="25" Height="25" /> </ItemTemplate> </asp:TemplateField> <%-- <asp:TemplateField HeaderText="Send Email"> <ItemStyle HorizontalAlign="Center" CssClass="col-sm-1" /> <ItemTemplate> <asp:ImageButton ID="btnEmail" runat="server" ImageUrl="~/App_Themes/Images/Email.png" OnClientClick='return confirm("Are you sure to send this Work Order?");' CommandArgument='<%#Eval("JobOrderNo") %>' CommandName="Email" Width="25" Height="25" /> </ItemTemplate> </asp:TemplateField>--%> </Columns> <EmptyDataTemplate> <asp:Label ID="Label6" runat="server" Text="No record found..."></asp:Label> </EmptyDataTemplate> </asp:GridView> </div> <div id="DivFooterRow" style="overflow: hidden"> </div> <div class="row"> <div class="col-sm-8"> <asp:HiddenField ID="hidPageNo" runat="server" Value="1" /> <uc1:PagingControl ID="gvPager" Visible="false" FirstString="<< First" LastString=" Last >>" NextString="Next >" PrevString="< Prev" TotalNumberPaging="10" OnPaging_Click="gvPager_Paging_Click" runat="server" /> </div> </div> </ContentTemplate> </asp:UpdatePanel> <table> <tr> <td rowspan="3"></td> </tr> </table>