0
votes

I am exporting the grid data to the PDF file by using iTextSharp. I am searching the billno and fetched data is relating on the grid and control( in ext.net). Searching can be in 3 ways: 1. By inserting billno and pressing enter in combo box 2. By inserting billno and click the trigger in combo 3. By Selecting billno from combo Now after that I click on ToPDF button to export data. If I perform 2 & 3, its working fine, but when I perform 1 then a window comes with header Request failure, Status text - communication failure. As the Grid data are exported also, but y this window appears that I m nt getting.

My Code is as below .cs

protected void ToPDF(object sender, EventArgs e)
{
      //Code
}

.aspx

 <ext:ComponentMenuItem ID="ComponentMenuItem1" runat="server">
                                                        <Component>
                                                               <ext:ComboBox ID="cmbSearchBillno" runat="server" 
                                                                    EmptyText="Select Bill No" 
                                                                    ForceSelection="true"   
                                                                    StoreID="BillMasterStore"  
                                                                    DisplayField="Billno" ValueField="BillId">
                                                                    <Triggers>
                                                                        <ext:FieldTrigger Icon="Search" />
                                                                    </Triggers>
                                                                     <Listeners>
                                                                        <SpecialKey Fn="enterKeyPressHandler" />
                                                                    </Listeners>
                                                                    <DirectEvents>
                                                                         <%--<SpecialKey OnEvent="enterKeyPressHandler" ShowWarningOnFailure="false" Timeout="60000" StopEvent="true">
                                                                            <ExtraParams>
                                                                                <ext:Parameter Name="key" Value="e.getKey()" Mode="Raw">
                                                                                </ext:Parameter>
                                                                                <ext:Parameter Name="BillNo" Value="this.getText()"  Mode="Raw"></ext:Parameter>
                                                                            </ExtraParams>
                                                                        </SpecialKey>--%>
                                                                        <Select OnEvent="ChangeBillno">
                                                                            <ExtraParams>
                                                                                <ext:Parameter Name="BillNo" Value="record.id" Mode="Raw"></ext:Parameter>
                                                                            </ExtraParams>
                                                                        </Select>
                                                                        <TriggerClick OnEvent="SearchBillDetails" >
                                                                            <ExtraParams>
                                                                                <ext:Parameter Name="BillNo" Value="this.getText()" Mode="Raw"></ext:Parameter>
                                                                            </ExtraParams>
                                                                        </TriggerClick>
                                                                    </DirectEvents> 

                                                                </ext:ComboBox>
                                                        </Component>                        
                                                    </ext:ComponentMenuItem>

ToPDF button

  <ext:Button ID="btnPdf" runat="server" Text="To PDF" AutoPostBack="true" OnClick="ToPDF"  Icon="PageWhiteAcrobat">
                                        <Listeners>
                                            <Click Fn="saveData" />
                                        </Listeners>
                                     </ext:Button>

Script

<script type="text/javascript">

       var enterKeyPressHandler = function (f, e) {
           if (e.getKey() == e.ENTER) 
           {
                var billno=this.getText();
                Ext.net.DirectMethods.SearchBillno(billno);

                e.stopEvent();
                this.send();
           }
       }


         var saveData = function () {
           GridData.setValue(Ext.encode(GridService.getRowsValues({selectedOnly : false,excludeId:true})));
        };


    </script>
1

1 Answers

0
votes

yeah it will throw error when you search with enter key this is because you are using direct method in listener to fill up the grid. By looking at your code i can see that u have used direct event Special Key which you have commented before..use that direct event Special Key and it will work