OK. I have a WebCombo that I bind to a DataSet at runtime. I would like to enable AJAX conditional downloading of the text/values.
I know that I must set the attribute EnableXmlHTTP = true, and somehow handle the InitializeDataSource event. I'm stumped at what I'm supposed to do when handling that event.
I tried to handle that method with a routine that called DataBind if DataSource was not null, but that didn't work.
I'm hoping that there is something simple that I can do to implement this functionality, rather than having to implement my own AJAX framework.
In the combo's InitializeDataSource event, you need to populate the object you'll use for the combo's data source, and set that object to the combo's DataSource property (assuming that its DataSource isn't already set to this object). Typically, this is where you'd fill a DataSet or populate a list of custom business objects.
You want to avoid calling DataBind() in this event handler. If you handle this event, then DataBind() will be called implicitly when the event has completed.
Okay, but in my code's workflow, I set the datasource externally with MyCombo.DataSource= <some datasource>. I really don't see anything that needs to be done at InitializeDataSource that I'm not already doing.
Caveat - I'm extending the ComboBox and adding functionality, so I'm implementing this handler within the subclass. I am expecting consumers of this class to set DataSource themselves and then call DataBind. I don't know if this will affect your answer.
Am I supposed to be filtering the datasource based on user input criteria (e.g. if they entered "c", set DataSource equal to a view of all the data that begins with c), or is this something that the WebCombo will handle for me? This is really the crux of my question- I don't understand the workflow of the control.
Am I to understand that DataBind ought not be called if I'm using AJAX like this?
Thanks,
randrews said:Okay, but in my code's workflow, I set the datasource externally with MyCombo.DataSource= <some datasource>. I really don't see anything that needs to be done here that I'm not already doing.
randrews said:Am I supposed to be filtering the datasource based on user input criteria (e.g. if they entered "c", set DataSource equal to a view of all the data that begins with c), or is this something that the WebCombo will handle for me.
randrews said:Am I to understand that DataBind ought not be called if I'm using AJAX like this?
No, DataSource is nothing/a null reference when InitializeDataSource is fired.
EnableXmlHTTP is being set automatically in the control during the Load handler before calling the superclass OnLoad method- is this too late to be setting this attribute?
This is part of a class library, so I'd like to handle my housekeeping issues within my subclass, rather than requiring multple calls from my consuming UI classes.
Thanks for all the help. I now face the following:
1) The dropdown frequently blanks and no amount of erasure of previous input will bring it back.
2) I only seem to be able to see within the first 60 or so rows - there are over 1k rows in my dataset. Attempts to search for rows beyond this results in grid blanking.
ComboTypeAhead is set to "suggest".
randrews said:DataSource is nothing/a null reference when InitializeDataSource is fired.
randrews said:EnableXmlHTTP is being set automatically in the control during the Load handler before calling the superclass OnLoad method- is this too late to be setting this attribute?