Hi there
Normal 0 MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman";}
Somebody can help me with the load-on-demand feature at run time in v8.2 of WebCombo. I’m following the help guidelines but something might be wrong, the Combo doesn’t load on demand, only the first required rows, in this case 10, when you scroll down dosn't load the other records. Here you can see the code:
protected void Page_Load(object sender, EventArgs e) { this.WebCombo1.EnableXmlHTTP = true; this.WebCombo1.DisplayValue = "ShortName"; this.WebCombo1.DataTextField = "ShortName"; this.WebCombo1.DataValueField = "CCode"; this.WebCombo1.DropDownLayout.RowsRange = 10; this.WebCombo1.InitializeDataSource += new InitializeDataSourceEventHandler(WebCombo1_InitializeDataSource); }
void WebCombo1_InitializeDataSource(object sender, WebComboEventArgs e) { //Here I load a dataset with the table Countries
this.WebCombo1.DataSource = _datasetmain.Tables["LUP_Countries"].DefaultView; this.WebCombo1.DataBind(); }
I'll appreciate any help.
regards
Page_Load is too late to hook up the InitializeDataSource event. During its AJAX callbacks, the InitializeDataSource event occurs before Page_Load, which is why your additional rows don't load on demand.
Try doing this in Page_Init instead:
private void Page_Init(object sender, EventArgs e){ this.WebCombo1.InitializeDataSource += new InitializeDataSourceEventHandler(WebCombo1_InitializeDataSource);}
You should also remove the call to DataBind() in your InitializeDataSource event handler. A DataBind() is performed implicitly when this event is handled. Leaving it as-is won't prevent WebCombo from working, but you'll avoid some redundant processing by removing that line.
Vince - Can you provide the syntax for this same code in VB.Net? Thanks.
Hi,
Regarding the recomendation of not calling the DataBind() on the InitializeDataSource event handler, i would like to point a weird issue that i found.
When i read this recomendation, i proceeded to apply it on my application. But happen that some of my webcombos started to act weird.
I finaly found, that for this combos that were failing, in the InitializeDataSource event handler, after set the DataSource, an addiotinal element was being added to the WebCombo. And if I wouldnt perform the DataBind() the combo would show wrong the information, lets say if the DataSource would have 2 elements, what the combo would show in the list would be, first the item that was being added later, and then the second item of the DataSource.
Now this doesnt make any sense to me. Because after all i see the other combos working, so it means the DataBind is being perform as in this thread is indicated. And i dont see what is the difference if i add at the end of the event handler an extra DataBind.
Besides, I tried the DataBind after i set the DataSource and before It added the extra item, and it works fine too.
I would like to know if there is any special reason i would have to add a DataBind at the end of the InitializeDataSource event handler, Doest it makes any difference? I mean now i would have 2 DataBinds being performed at the end of the InitializeDataSource event handler.
Regards.-