I have a particularly nasty table ("Species") with 78 fields, of which 17 have Foreign Keys that each require an ASPxComboBox. What's more, there are 96568 records in the table. One of the FK fields is a drop-down on a table ("Genus") with 11260 records.
If I leave out all the FK fields, ASPxGridview takes 6 seconds to load the entire table, which I think is pretty amazing. Adding in all the LEFT JOIN statements and displaying the FK description instead of the numerical value adds only 2 seconds to the load time. Again, this is pretty impressive. ASPxGridView is amazing.
The problam comes when I click on the "Edit" button. The edit screen has been broken down into 5 tabbed pages, but if I have data-bound ASPxComboBoxes, then the edit form takes around 10 *minutes* to load, even with callbacks enabled and only 10 items being loaded. If I leave out the data binding, as per E1426, the load time is an impressive 12 *seconds*. I need some help in creating the code to bind the Combo Box back to its data source when the user clicks on the drop-down box in order to do some editing.
Here is a VB.NET code snippet using Northwind's SalesOrder table as an example:
<Templates>
<EditForm>
<dxe:ASPxLabel ID="ASPxLabelShipperId" runat="server" Text="Ship Via" ForeColor="navy"></dxe:ASPxLabel>
<dxe:ASPxComboBox ID="ASPxComboBoxSalesOrder__ShipperId" runat="server" visible="True" Value='<%# Eval("Shipper__ShipperName") %>' Width="400px" ValueField="SalesOrder__ShipperId" ValueType="System.Int32" EnableCallbackMode="True" EnableIncrementalFiltering="True" CallbackPageSize="10" OnCallback="OnCallbackSalesOrder__ShipperId" ></dxe:ASPxComboBox><Columns><dxe:ListBoxColumn Caption="Shipper" FieldName="Shipper__ShipperName" Width="400px" /></Columns></dxe:ASPxComboBox>
</EditForm>
etc. The data source definition looks like this:
<% '-- FK Data Source: Shipper -- %>
<asp:SqlDataSource ID="SqlDataSourceShipperId" runat="server"
ConnectionString = "<%$ ConnectionStrings:SampleConnectionString %>"
SelectCommand="SELECT [ShipperId] AS SalesOrder__ShipperId, [ShipperName] AS Shipper__ShipperName FROM [Shipper] ORDER BY [ShipperName]">
<UpdateParameters>
<asp:Parameter Name="SalesOrder__ShipperId" Type="Int32" />
<asp:Parameter Name="Shipper__ShipperName" Type="String" />
</UpdateParameters>
</asp:SqlDataSource>
and I have created a VB.NET callback event as follows:
Protected Sub OnCallbackSalesOrder__ShipperId(ByVal source As Object, ByVal e As CallbackEventArgsBase)
End Sub ' OnCallbackSalesOrder__ShipperId
What code do I put in this subroutine to get it to tell the control to use "SqlDataSourceShipperId" as the data source?
I have struggled to figure this out, and I'm getting nowhere. Please help! VB.NET is still a strange language to me after years of using VBA and VB6. I have searched through the code samples but this one is eluding me.
Thanks in advance
Donn