I have a webcombo on a webform (not in a grid). I set the datasource to a datatable in the InitializeDataSource event. With EnableXMLHttp turned OFF I can successfully set my selected value (from a businessobject) in the DataBound event of the combo and it displays correctly. With EnableXMLHttp turned ON this does not work unless the value selected happens to be one of the first rows in the combo. How can I force a row to be selected when the control has yet to load it due to the enablexmlhttp setting? I have a combo with 300+ rows and need to show the value that was previously selected and saved to the database.
Thank you,
Heather
Has no one else has this problem? The page/combobox load time without EnableXMLHttp is very user-unfriendly but I cannot get my initial value selected with it off.
Hello,
Can you give the exact source code you're using ?
Give as much information as you can, so others can reproduce the problem
private _data as datatable (loaded elsewhere in code)
protected sub capturevehiclecombo_initializedatasource()
capturevehiclecombo.datakeyfield="vehicleid"
capturevehiclecombo.datasource = me.currsess.db.getvehicles()
end sub
protected sub capturevehiclecombo_databound()
dim val as object = _data.rows(0)("capturevehicleid")
If Not IsDBNull(val) Then
If Not cell Is Nothing Then
capturevehiclecombo.SelectedIndex = cell.Row.Index
End If
End Sub
With EnableXMLHttp set to True the FindByValue returns nothing unless the value happens to be in the first set of rows loaded. With EnableXMLHttp set to False it works.
This is a very practical question, is there a practical answer? EnableXMLHttp in webcombo is a great feature for handeling large datasets with good performance, but it's utility is somewhat blunted if you can't set the selection of any given item in the dataset. Is there a way to force the webcombo to "page" to the record that needs to be selected?
Has there been a practical solution offered for this problem? I agree it is a very practical question and can't see a practical use for the webcombo control if setValue, setDataValue etc. does not work for all dataset values while EnableXMLHttp is true.
I'm interested to hear if there has been any success with work-arounds.
Here is the solution provided to me by infragistics support:
In the webcombo's "InitialiseLayout" event handler, set RowsRange to the number of rows in the underlying datasource:
webcombo.DropDownLayout.RowsRange = datatable.Rows.Count
(where datatable is the combo's datasource)
This will result in all records being shown in the drop down from the get-go and probably does not meet your requirements. This solves my problem but my requirement varies in that I only really needed the EnableXmlHTTP property set to true so that I could filter the drop down in javascript using selectWhere(). I didn't necesarily need the "on demand" loading of drop-down rows provided by EnableXmlHTTP.