473,799 Members | 2,741 Online
Bytes | Software Development & Data Engineering Community
+ 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.Sql Client.SqlComma nd("spToddsRate Test",
cn)
cmd4.CommandTyp e = CommandType.Sto redProcedure
dr = cmd4.ExecuteRea der
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 3250
ba******@yahoo. com (Todd) wrote in message news:<eb******* *************** ****@posting.go ogle.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.Sql Client.SqlComma nd("spToddsRate Test",
cn)
cmd4.CommandTyp e = CommandType.Sto redProcedure
dr = cmd4.ExecuteRea der
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.E val(Container.D ataItem, "FieldName" )%>
</itemTemplate>
</asp:DataList>

HTH
Regards
Sushila
..NET MVP
"Todd" <ba******@yahoo .com> wrote in message news:eb******** *************** ***@posting.goo gle.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.Sql Client.SqlComma nd("spToddsRate Test",
cn)
cmd4.CommandTyp e = CommandType.Sto redProcedure
dr = cmd4.ExecuteRea der
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
2511
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" RepeatLayout="table" cellspacing="0" cellpadding="0" runat="server" horizontalalign="center" width="100%" borderwidth="0"> <headertemplate> <table width="100%" cellpadding=0 cellspacing=0>
0
3118
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. However, the DataGrid begins to get very cumbersome as the number of columns of data you present increases. Anything more than half a dozen columns or so and you probably induce horizontal scrolling - a real no-no for me. If you put such a...
2
325
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 point me to a code sniippet or something on finding a table in the datalist?
6
1604
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!:) Whats missing in VStudio .Net? Imports System.Data.SqlClient
5
3872
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 have run into a situation repeatedly with the designing factor of a datalist. Most of the time when I use a datalist I utilize the header, item, and footer templates to build a custom table. However, utilizing the simple example below you will...
8
5894
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 that, I display End_Date on the DataList control. The output looks like 3/18/2005 12:00:00 AM . I'd like to format data for this field to be 3/18/2005. Please help me. Thanks in advance....
5
3791
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...: <asp:datalist id="DataList1" runat="server"> <HeaderTemplate> <table border="0" cellpadding="0" cellspacing="0" width="400"> <tr> <td width="100">First Name</td>
0
1189
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 access the TR tag inside the current DataList row and add an attribute "display:none" so that the row itself doesnt even display. The problem is even after set the TR tag to runat server, while I can access the ID in the code behind, I always get...
4
2074
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. Started new windows application. 2. Deleted the code files (program.cs, form.cs)
0
9688
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10490
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10259
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7570
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6809
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5589
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3761
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.