Help with WebListBox update

Hello.

I am trying to update a WebListbox and when I filter my weblistbox the code seems to be executing, but my weblistbox is not getting updated.

I have taken the example project, and replaced the sqlite with mysql connectivity. There is still a lot of “old” code in the project. The methods of concern are the LoadMitzvahs and the FindMitzvahs in the CustomerDetailPage.

Any ideas?

Project

Note that any update happens only when the event is over.

If you want real time update, you must do that in a timer.

Manuel, that has absolutely nothing to do with the thread. Please start your own thread for your question.

I am sorry. I deleted it and I put it in the correct thread.

I am not following. There is a timer which calls loadmitzvah.
I adapted this from the Eddies electronics web app, which works fine using sqlite. When switching to mysql the weblistbox does not seem to update after the initial load. Is there a simple example you can point to so I can see what you mean?

Robb

how you update the listbox from DB or array

I am updating from DB.

Here is the code from the Action Event of my WebTimer

[code]Dim mitzvahRS As RecordSet
mitzvahRS = Session.Mitzvahs.FindMitzvahByName(Session.SearchTerm)

If mitzvahRS <> Nil Then
CustomerList.DeleteAllRows

'Dim mitzvahRS As RecordSet
'mitzvahRS = App.mDB.SQLSelect(sql)

For i As Integer = 1 To mitzvahRS.RecordCount
  CustomerList.AddRow(mitzvahRS.Field("Name").StringValue) 
  CustomerList.RowTag(CustomerList.LastIndex) = mitzvahRS.Field("ID").IntegerValue
  mitzvahRS.MoveNext
Next

CustomerList.ListIndex = 0

mitzvahRS.Close

End If[/code]

This runs, but no update of my WebListBox occurs beyond the first loading of the WebListBox.

Robb

Your for i - next refactored for the Action Event of a multiple timer :

Static i as Integer = 1 If i < mitzvahRS.RecordCount then CustomerList.AddRow(mitzvahRS.Field("Name").StringValue) CustomerList.RowTag(CustomerList.LastIndex) = mitzvahRS.Field("ID").IntegerValue mitzvahRS.MoveNext i = i + 1 else i = 1 CustomerList.ListIndex = 0 mitzvahRS.Close me.Mode = Timer.ModeOff end if

Instead of all the Addrow happening in the same event, they will now happen in different events, and the UI will update each time.

Where you now have the loop, start the timer as

TimerUpdate.Mode = Timer.ModeMultiple

Which replaces the end of your code.

You will have to experiment with the period of the timer, depending on the speed of your database. I would start with 20.

[quote=293502:@Michel Bujardet]
You will have to experiment with the period of the timer, depending on the speed of your database. I would start with 20.[/quote]
20ms is too fast for a live site. You should be thinking about values like 500 or 1000 to keep the app responsive for all of your users.

Right. Thanks. At any rate from what I have tested, the WebTimer cannot go as fast. It seems limited to 200ms.

And probably you shouldn’t use static variables because their scope is over all session.

Good point. I typed that in the forum. A webPage property is much better in such a case.

Not having any success.

Where are the RS defined and where does the delete all rows command get placed in the timer control or some other event.
The search term does not seem to be firing the timer with the multiple mode enabled.

'mitzvahRS = Session.Mitzvahs.FindMitzvahByName(Session.SearchTerm)
'CustomerList.DeleteAllRows

Thank you,
Robb

RS ?

The search term won’t start the timer if you don’t do it in your code with timer.mode, as posted above.