I have a question about loading a listbox from a dataset.

G

Gordon

Hi;

I am trying to port a windows app which works to a web
app.

I select a date from a calender control then use that date
to select a corresponding record in a datset. When I
execute the same code section where I select a record from
a datatable I get an error message that says that the
column I want to match is not found. Here is the code
which is in a subroutine that is called from the calender
date_selected event. The dataset is created in another
subroutine. Why doesn't Asp.Net recognize the .Select
statement but windows does ?

Dim nRow As DataRow()
Dim irow As DataRow
nRow = tblCaseDocs.Select("doc_dte_due = '" &
holdDte.ToString & "'")

ListBox1.Items.Clear()

For Each irow In nRow
ListBox1.Items.Add(irow("case_id") & " " &
irow("Document_Nme"))
Next

Thanks,

Gordon
 
A

Alvin Bruney

Listbox are different beasts in the web environment so you have to do things
a bit differently. You're going the long way around the park here. Fire your
select and return the values in a dataset like this:
DataSet ds = query blah blah blah
Then bind your dataset to the list box like so

listbox.datasource = ds;
listbox.datatextformat = "case_id" //this is the column you want to display
in the listbox
listbox.databind();
roughly

regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top