Exports and sorts no longer working for WebGrid

2 replies. Last post: December 21, 2015 4:51 AM by Yudi
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback
Joshua FloanMember

Hello,  I am new to webgrid.  I took over a project that uses a few webgrids.   I am using Webgrid v8_0_7200 with an ASP.NET applition.  I changed the filter a little bit,  and now my exports and sorts no longer work.  This functionality worked prior to me putting in additional filters.  So it is obviosuly something I did incorrect.  The data filters appropriately in the grid,  I just lost the export and sort function.  I get the error: 

Unable to communicate with server.  


I am hoping someone can tell me what I am missing here.  Thank you in advance. 

VB.NET Code:

 
Protected Sub WebGrid1_Export(ByVal sender As ObjectByVal e As ISNet.WebUI.WebGrid.ExportEventArgsHandles WebGrid1.Export
    Dim Margins As New ISNet.WebUI.WebGrid.Margins
    Margins.Bottom = 0
    Margins.Left = 0
    Margins.Right = 0
    Margins.Top = 0
    e.ReportInfo.DynMargins = Margins
End Sub
 
Protected Sub btnDisplay_Click(ByVal sender As ObjectByVal e As System.EventArgsHandles btnDisplay.Click
    Try
        PopulateDefaultValues()
        WebGrid1.DataSourceID = "dsContract_Summary"
        WebGrid1.ClearCachedDataSource()
        WebGrid1.RebindDataSource()
        WebGrid1.Visible = True
        StripDefaultValues()
    Catch ex As Exception
        Dim strMessage As String
        strMessage = ex.Message.ToString()
    End Try
End Sub


ASPX code:

<ISWebGrid:WebGrid ID="WebGrid1" runat="server" DefaultStyleMode="Silver" Height="700px" UseDefaultStyle="True" Width="99%">
    <LayoutSettings AllowColumnMove="Yes" AllowExport="Yes" AllowFilter="Yes" AllowGrouping="Yes" AllowSelectColumns="Yes" AllowSorting="Yes" AutoFilterSuggestion="True" AutoWidth="false" ColumnFooters="Yes" GroupByBoxVisible="True" PagingMode="ClassicPaging" PagingExportMode="ExportAllData">
    </LayoutSettings>
 
    <RootTable Caption="Contract Summary" DataKeyField="Contract ID" GroupTotalVisible="True">
        <Columns>
            <ISWebGrid:WebGridColumn Caption="Contract ID" ColumnType="HyperLink" DataMember="Contract Id" DataType="System.Int32" HyperlinkFormatString="../../AM/Contract_USC.aspx?ContractId={0}" HyperlinkTarget="Self" Name="ContractID" Width="75px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Print" ColumnType="HyperLink" DataMember="Contract Id" DataType="System.Int32" HyperlinkFormatString="../../AM/Contract_USC_Print.aspx?ContractId={0}" HyperlinkDisplayText="Print" HyperlinkTarget="Blank" Name="Print" Width="45px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Scanned Contract" DataMember="Contract ID" Name="ContractIDDocs" Width="50px" ColumnType="Template">
                <CellTemplate>
                    <span title="Click here to view scanned documents" class="Scanned_Document_Popup_Link" onclick="ShowDocuments('ContractNumber=<%#Eval("Contract ID")%>');">Docs</span>
                </CellTemplate>
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="From Date" DataFormatString="d" DataMember="From Date" DataType="System.DateTime" Name="FromDate" Width="75px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="To Date" DataFormatString="d" DataMember="To Date" DataType="System.DateTime" Name="ToDate" Width="75px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Created Date" DataFormatString="d" DataMember="Created Date" DataType="System.DateTime" Name="CreatedDate" Width="75px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Created By" DataMember="Created By" Name="CreatedBy" Visible="False" Width="100px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Division ID" DataMember="Division ID" DataType="System.Int32" Name="DivisionID" Visible="False" Width="75px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Company ID" DataMember="Company ID" DataType="System.Int32" Name="CompanyID" Visible="False" Width="75px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Company Name" DataMember="Company" Name="CompanyName" Visible="False" Width="75px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Company" DataMember="Company" Name="Company" Width="125px" ColumnType="Template">
                <CellTemplate>
                    No Name Found
                </CellTemplate>
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Scanned Division Docs" DataMember="Company" Name="CompanyEdit" Width="50px" ColumnType="Template">
                <CellTemplate>
                    <span title="Click here to view scanned documents" class="Scanned_Document_Popup_Link" onclick="ShowDocuments('DivisionId=<%#Eval("Division ID")%>');">Docs</span>&nbsp;
                </CellTemplate>
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Product ID" DataMember="Product ID" DataType="System.Int32" Name="ProductID" Visible="False" Width="75px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Product" DataMember="Product" Name="Product" Width="125px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn AggregateFunction="Sum" Caption="Contract Qty" DataFormatString="n2" DataMember="Contract Qty" DataType="System.Decimal" Name="ContractQty" Width="80px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn AggregateFunction="Sum" Caption="Shipments Qty" DataFormatString="n2" DataMember="Shipments Qty" DataType="System.Decimal" Name="ShipmentsQty" Width="90px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn AggregateFunction="Sum" Caption="Settled Qty" DataFormatString="n2" DataMember="Settled Qty" DataType="System.Decimal" Name="SettledQty" Width="80px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn AggregateFunction="Sum" Caption="UnSettled Qty" DataFormatString="n2" DataMember="UnSettled Qty" DataType="System.Decimal" Name="UnSettledQty" Width="80px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="UOM ID" DataMember="UOM ID" DataType="System.Byte" Name="UOMID" Visible="False" Width="50px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="UOM" DataMember="UOM" Name="UOM" Width="40px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Shipment Status" DataMember="Shipment Status" Name="ShipmentStatus" Width="100px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Shipment Count" DataFormatString="n0" DataMember="Shipment Count" DataType="System.Int32" Name="ShipmentCount" Visible="False" Width="100px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Contract Adjustments" DataMember="Contract Adjustments" Name="ContractAdjustments" Width="125px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Payables &amp; Receivables" DataMember="Payables &amp; Receivables" Name="PayablesReceivables" Width="135px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Buy Sell Type ID" DataMember="Buy Sell Type ID" DataType="System.Byte" Name="BuySellTypeID" Visible="False" Width="100px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Buy Sell" DataMember="Buy Sell" Name="BuySell" Width="75px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Trader" DataMember="Trader" Name="Trader" Width="100px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Contract Month ID" DataMember="Contract Month ID" DataType="System.Int32" Name="ContractMonthID" Visible="False" Width="100px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Month" DataMember="Month" Name="Month" Width="50px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Futures" DataFormatString="c4" DataMember="Futures" DataType="System.Decimal" Name="Futures" Width="75px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Basis" DataFormatString="c4" DataMember="Basis" DataType="System.Decimal" Name="Basis" Width="75px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Price" DataFormatString="c4" DataMember="Price" DataType="System.Decimal" Name="Price" Width="75px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Market Zone ID" DataMember="Market Zone ID" DataType="System.Int32" Name="MarketZoneID" Visible="False" Width="100px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Market Zone" DataMember="Market Zone" Name="MarketZone" Width="100px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Market Adj" DataFormatString="c4" DataMember="Market Adj" DataType="System.Decimal" Name="MarketAdj" Width="75px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Shipment Type" DataMember="Shipment Type" Name="ShipmentType" Width="100px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Ship Method Type Id" DataMember="Ship Method Type Id" DataType="System.Byte" Name="ShipMethodTypeId" Visible="False" Width="125px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Ship Method" DataMember="Ship Method" Name="ShipMethod" Width="75px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Weight To Govern ID" DataMember="Weight To Govern ID" DataType="System.Byte" Name="WeightToGovernID" Visible="False" Width="125px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="WTG" DataMember="Weight To Govern" Name="WeightToGovern" Visible="False" Width="100px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="FOB" DataMember="FOB" Name="FOB" Width="100px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="PO" DataMember="PO" Name="PO" Width="75px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Remarks" DataMember="Remarks" Name="Remarks" Visible="False" Width="100px">
            </ISWebGrid:WebGridColumn>
            <ISWebGrid:WebGridColumn Caption="Specifications" DataMember="Specifications" Name="Specifications" Visible="False" Width="100px">
            </ISWebGrid:WebGridColumn>
        </Columns>
    </RootTable>
</ISWebGrid:WebGrid>
<asp:SqlDataSource ID="dsContract_Summary" runat="server" ConnectionString="<%$ ConnectionStrings:AgMotionNS %>" SelectCommand="Contract_Summary_USC" SelectCommandType="StoredProcedure">
    <SelectParameters>
        <asp:SessionParameter Name="TraderGroupId" SessionField="TraderGroupId" Type="Int32" />
        <asp:ControlParameter ControlID="txtContractId" Name="ContractId" PropertyName="Text" Type="String"  />
        <asp:ControlParameter ControlID="ddlDivisionId" Name="DivisionId" PropertyName="SelectedValue" Type="Int32" />
        <asp:ControlParameter ControlID="ddlProductGroup" Name="ProductGroupId" PropertyName="SelectedValue" Type="Int32" />
        <asp:ControlParameter ControlID="ddlBuySell" Name="BuySell" PropertyName="SelectedValue" Type="Int32" />
        <asp:ControlParameter ControlID="ddlTraders" Name="TraderID" PropertyName="SelectedValue" Type="Int32" />
        <asp:ControlParameter ControlID="ddlShipMethodType" Name="ShipmentMethodType" PropertyName="SelectedValue" Type="Int32" />
        <asp:ControlParameter ControlID="ddlMarketZone" Name="MarketZone" PropertyName="SelectedValue" Type="Int32" />
        <asp:ControlParameter ControlID="txtDateFrom" Name="DateFrom" PropertyName="SelectedDate" Type="DateTime" />
        <asp:ControlParameter ControlID="txtDateTo" Name="DateTo" PropertyName="SelectedDate" Type="DateTime" />
        <asp:ControlParameter ControlID="txtDateCreatedFrom" Name="DateCreatedFrom" PropertyName="SelectedDate" Type="DateTime" />
        <asp:ControlParameter ControlID="txtDateCreatedTo" Name="DateCreatedTo" PropertyName="SelectedDate" Type="DateTime" />            
    </SelectParameters>
</asp:SqlDataSource>


All times are GMT -5. The time now is 7:48 PM.
Previous Next