473,468 Members | 1,314 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 3226
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Joe | last post by:
Hey, Can anyone out there see why when this code renders there's a 1px space between the headertemplate and the itemtemplate. <asp:datalist id="asplistDL" BorderStyle="None"...
0
by: Alex | last post by:
Interested in more .NET stuff visit www.dedicatedsolutions.co.uk The DataList is not as powerful as the DataGrid. It requires more work from you since it has no default data presentation format....
2
by: IGotYourDotNet | last post by:
Can anyone tell me how to find a table within a datalist? I can find the labels and textboxes in the dl and change the formatting based on the data, but I can't find the table in the DL. Can anyone...
6
by: Patrick.O.Ige | last post by:
Hi guys, Just using these small snippet below using Datalist with sorting! But it appears i can see no Data on the screen when compiled with Visual Studio .Net! With WebMatrix its running fine!:)...
5
by: Martman | last post by:
First here is my goal: When a datalist is rendered to a page and you use the <itemtemplate> the datalist automatically prints a <tr> <td> start and end tags. Now this may not be too bad but I...
8
by: bienwell | last post by:
Hi, I have a problem of displaying data bound by a datalist control. In my table, I have a field Start_date which has Short Date data type. I tried to update this field by Current Date. After...
5
by: Ben Fidge | last post by:
I'm using DataList to present tabular data but am often having problems with some rows column alignment being out of synch with the rest of the rows. My DataList looks similar to this...: ...
0
by: JP | last post by:
I have a DataList control that contains a TABLE in it. I am evaluating weather or not the DateTime value coming back from DataBinder.Eval is blank or not. If the value is blank then I want to...
4
by: garyusenet | last post by:
Hi. I am trying to learn about array lists, and found an example on MSDN. I tried to compile it but it's not producing any output. I can't see why. Any ideas? Here is what I did. 1....
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.