Web 2.0 WebListBox - getting data from a selected row

I’m trying out the Web 2.0 WebListBox with the WebDataSource and dynamic population. Thanks to the forums, I got the Interfaces checked and got that issue working (That should be in the Example Project somewhere, very easy to overlook), but am now struggling on how to get data out of a selected row that was dynamically populated.

Specifically, I want to get the value of a column of a selected row. I’d also like to see how to get the row tag for that row so I can pull the full row record from the database. The example project doesn’t do that, so unsure and the doc’s are pretty light.

Can someone point me in the right direction or provide some sample code?

(I’m sure this is due to me not being an expert on this and not that’s not possible, so apologies in advance!)

Thanks!

Hi Stephen,

The only way I’ve found to do this is to get the data from the database itself, and not the WebListBox cells/rows. More specifically: getting the Primary Key from the selected row, and then using that to query the database to get the specific columns I need.

In the RowData method of the WebDataSource class that I’ve created, when I add the row to the WebListBox, I’m filling row.tag with the primary key value. This way, I can call:
dim sID as string = listbox1.RowTagAt(ListBox1.SelectedRowIndex) to get that value based on the selection.

Hope this gives some direction at least. Again though, this may not be the best/proper way to do it, but given the lack of documentation, it’s what I’ve figured out so far.

Cheers

Hi Andrew,

Thank you so much, even if it’s not the best/proper way to do it, it’s just what I needed to proceed!

THANK YOU!!

1 Like