DataList output is producing a blank table?

Discussion in 'ASP .Net' started by Todd, Jul 24, 2003.

  1. Todd

    Todd Guest

    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.
    Todd, Jul 24, 2003
    #1
    1. Advertising

  2. Todd

    Todd Guest

    (Todd) wrote in message news:<>...
    > 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?
    Todd, Jul 25, 2003
    #2
    1. Advertising

  3. 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" <> wrote in message news:...
    > 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.
    Sonali.NET[MVP], Jul 26, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andy Holyer
    Replies:
    0
    Views:
    1,986
    Andy Holyer
    Apr 12, 2006
  2. Nevyn Twyll
    Replies:
    8
    Views:
    1,867
  3. MattC
    Replies:
    2
    Views:
    498
    Kevin Spencer
    Sep 27, 2004
  4. Replies:
    1
    Views:
    463
    =?Utf-8?B?bGF0aGEgdmFsbGluYXlhZ2Ft?=
    May 5, 2005
  5. blomkaal
    Replies:
    2
    Views:
    1,105
    blomkaal
    Feb 14, 2011
Loading...

Share This Page