Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > DataList output is producing a blank table?

Reply
Thread Tools

DataList output is producing a blank table?

 
 
Todd
Guest
Posts: n/a
 
      07-24-2003
I am somewhat new to ASP.NET and I am probably overlooking some basic
rule that's causing my error. Anyways, here's the scoop: I am using
a DataReader to access a SQL stored procedure. I want the result set
from the DataReader to be dumped into a DataList and displayed on the
page. I already know that my data, the stored procedure, and the
database connectivity all work correctly because I have outputted all
this data to a dataGrid control. Now I am trying to output to a
DataList control, and all I get is a blank browser screen. I don't
get any errors. And if I use my mouse to try and "highlight" the
blank browser, I can see that there are some empty rows in a table
structure. Looking at the source code in the browser, I see a table
with 6 empty rows. This would make sense because my query should
produce 6 records to be output. The HTML code is below, I just used
the drag-and-drop editor to insert this DataList control:

<aspataList id="dl" runat="server"></aspataList>

The code-behind page with the necessary code is here (dl is the
datalist control, dr is the datareader control, cn is the connection):

'the connection string has already been set and is open
Dim cmd4 As New System.Data.SqlClient.SqlCommand("spToddsRateTest" ,
cn)
cmd4.CommandType = CommandType.StoredProcedure
dr = cmd4.ExecuteReader
dl.DataSource = dr
dl.DataBind()
dr.Close()
cn.Close()

Any thoughts as to why this is producing a blank screen with no
errors? The visible property is set to true.
 
Reply With Quote
 
 
 
 
Todd
Guest
Posts: n/a
 
      07-25-2003
http://www.velocityreviews.com/forums/(E-Mail Removed) (Todd) wrote in message news:<(E-Mail Removed). com>...
> I am somewhat new to ASP.NET and I am probably overlooking some basic
> rule that's causing my error. Anyways, here's the scoop: I am using
> a DataReader to access a SQL stored procedure. I want the result set
> from the DataReader to be dumped into a DataList and displayed on the
> page. I already know that my data, the stored procedure, and the
> database connectivity all work correctly because I have outputted all
> this data to a dataGrid control. Now I am trying to output to a
> DataList control, and all I get is a blank browser screen. I don't
> get any errors. And if I use my mouse to try and "highlight" the
> blank browser, I can see that there are some empty rows in a table
> structure. Looking at the source code in the browser, I see a table
> with 6 empty rows. This would make sense because my query should
> produce 6 records to be output. The HTML code is below, I just used
> the drag-and-drop editor to insert this DataList control:
>
> <aspataList id="dl" runat="server"></aspataList>
>
> The code-behind page with the necessary code is here (dl is the
> datalist control, dr is the datareader control, cn is the connection):
>
> 'the connection string has already been set and is open
> Dim cmd4 As New System.Data.SqlClient.SqlCommand("spToddsRateTest" ,
> cn)
> cmd4.CommandType = CommandType.StoredProcedure
> dr = cmd4.ExecuteReader
> dl.DataSource = dr
> dl.DataBind()
> dr.Close()
> cn.Close()
>
> Any thoughts as to why this is producing a blank screen with no
> errors? The visible property is set to true.


Does anyone have a clue why I am not getting the data to output in my DataList?
 
Reply With Quote
 
 
 
 
Sonali.NET[MVP]
Guest
Posts: n/a
 
      07-26-2003
You'll need to use ItemTemplate Tag
<aspataList id="dl" runat="server">
<itemTemplate>
<%#DataBinder.Eval(Container.DataItem, "FieldName")%>
</itemTemplate>
</aspataList>

HTH
Regards
Sushila
..NET MVP


"Todd" <(E-Mail Removed)> wrote in message news:(E-Mail Removed) om...
> I am somewhat new to ASP.NET and I am probably overlooking some basic
> rule that's causing my error. Anyways, here's the scoop: I am using
> a DataReader to access a SQL stored procedure. I want the result set
> from the DataReader to be dumped into a DataList and displayed on the
> page. I already know that my data, the stored procedure, and the
> database connectivity all work correctly because I have outputted all
> this data to a dataGrid control. Now I am trying to output to a
> DataList control, and all I get is a blank browser screen. I don't
> get any errors. And if I use my mouse to try and "highlight" the
> blank browser, I can see that there are some empty rows in a table
> structure. Looking at the source code in the browser, I see a table
> with 6 empty rows. This would make sense because my query should
> produce 6 records to be output. The HTML code is below, I just used
> the drag-and-drop editor to insert this DataList control:
>
> <aspataList id="dl" runat="server"></aspataList>
>
> The code-behind page with the necessary code is here (dl is the
> datalist control, dr is the datareader control, cn is the connection):
>
> 'the connection string has already been set and is open
> Dim cmd4 As New System.Data.SqlClient.SqlCommand("spToddsRateTest" ,
> cn)
> cmd4.CommandType = CommandType.StoredProcedure
> dr = cmd4.ExecuteReader
> dl.DataSource = dr
> dl.DataBind()
> dr.Close()
> cn.Close()
>
> Any thoughts as to why this is producing a blank screen with no
> errors? The visible property is set to true.


 
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
ModelSim and GHDL not producing the same output blomkaal VHDL 2 02-14-2011 08:35 AM
blank CD-R and blank DVD-R not recognized by Vista 64 Ultimate =?Utf-8?B?R3JlZyBLaXJrcGF0cmljaw==?= Windows 64bit 13 11-07-2007 12:23 PM
Setting up a datalist control - Item_DataBound for a datalist in a datalist Nevyn Twyll ASP .Net 8 09-09-2004 10:13 PM
Default text for blank or empty datalist j_ruez ASP .Net 1 02-26-2004 06:37 PM



Advertisments