469,575 Members | 1,275 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,575 developers. It's quick & easy.

DataList output is producing a blank table?

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:

<asp:DataList id="dl" runat="server"></asp:DataList>

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.
Nov 17 '05 #1
2 3110
ba******@yahoo.com (Todd) wrote in message news:<eb**************************@posting.google. 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:

<asp:DataList id="dl" runat="server"></asp:DataList>

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?
Nov 17 '05 #2
You'll need to use ItemTemplate Tag
<asp:DataList id="dl" runat="server">
<itemTemplate>
<%#DataBinder.Eval(Container.DataItem, "FieldName")%>
</itemTemplate>
</asp:DataList>

HTH
Regards
Sushila
..NET MVP
"Todd" <ba******@yahoo.com> wrote in message news:eb**************************@posting.google.c 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:

<asp:DataList id="dl" runat="server"></asp:DataList>

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.


Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Joe | last post: by
2 posts views Thread by IGotYourDotNet | last post: by
6 posts views Thread by Patrick.O.Ige | last post: by
5 posts views Thread by Martman | last post: by
8 posts views Thread by bienwell | last post: by
5 posts views Thread by Ben Fidge | last post: by
4 posts views Thread by garyusenet | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.