Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > I have a question about loading a listbox from a dataset.

Reply
Thread Tools

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

 
 
Gordon
Guest
Posts: n/a
 
      11-26-2003
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
 
Reply With Quote
 
 
 
 
Alvin Bruney
Guest
Posts: n/a
 
      11-26-2003
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
"Gordon" <(E-Mail Removed)> wrote in message
news:068e01c3b3c9$30dd3e30$(E-Mail Removed)...
> 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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Listbox selection to populate another listbox? Chris Kettenbach ASP .Net 3 06-16-2005 09:19 PM
Listbox item added with client scripts not submitting with ASP:Listbox Simon Prince ASP .Net 2 10-19-2004 04:11 PM
How do I move all items in a listbox to another listbox kent ASP .Net 1 05-03-2004 12:17 AM
click listbox and refresh another listbox DC Gringo ASP .Net 0 04-06-2004 02:13 AM
Re: now desparate! - 1st listbox contents disappears when 2nd listbox appears? blenderdude ASP .Net 0 08-03-2003 10:18 PM



Advertisments