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.
For VB.NET, you'll generally declare your event handler method with the "handles" keyword.
Private Sub WebCombo1_InitializeDataSource(ByVal sender as Object, ByVal e as InitializeDataSourceEventArgs) Handles WebCombo1_InitializeDataSource
If you need to use code to establish the event handler, use the "AddHandler" statement. The syntax is as follows:
AddHandler WebCombo1.InitializeDataSource, AddressOf WebCombo1_InitializeDataSource
As I stated in my previous post, my initial impression is that it shouldn't be necessary to call DataBind() at the end of the InitializeDataSource event handler. It does so implicitly when you handle this event. Calling DataBind() in this event causes extra overhead, and so decreases performance; it may have other effects that depend on what you're doing in your application.
More than this will likely require some in-depth research. I suggest you submit a support request and attach a sample project that we can run and debug that demonstrates the issue you've described.
Hi Vince,
I would like to know if you have any thoughts regarding my post of the 12 Feb 2009 18:20 , on this thread.
Thanks.-