Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

populate datalist from sql in asp.net

Posted on 2013-01-28
2
Medium Priority
?
293 Views
Last Modified: 2013-01-28
There seems to be a lot of ways to do this, I was wondering if I could get some examples and perhaps quick tips to fix my code.  Currently I can see blank lines where the data should be, but no data.
ASP:
  <td align="left">
            <b>Recent Billing Activity</b><asp:imagebutton id="lnkExpand" runat="server" />:
            <asp:datalist id="ddlBills" datakeyfield="StatementNumber" runat="server" cellpadding="4" Visible="true" Width="100%">
                <HeaderTemplate>
                    <td valign="top" width="14%" align="left">
                        <b>Status</b>
                    </td>
                    <td valign="top" width="14%" align="left">
                        <b>Bill #</b>
                    </td>
                    <td valign="top" width="14%" align="left">
                        <b>Bill Date</b>
                    </td>
                    <td valign="top" width="14%" align="left">
                        <b>Due Date</b>
                    </td>
                    <td valign="top" width="14%" align="left">
                        <b>Bill AMT</b>
                    </td>
                    <td valign="top" width="14%" align="left">
                        <b>Bal Due</b>
                    </td>
                    <td valign="top" width="14%" align="left">
                        <b>PDF</b>
                    </td>
                </HeaderTemplate>
                <itemtemplate>
                    <td valign="top" width="14%" align="left">
                        <asp:Label ID="lblStatus" runat="server" />
                    </td>
                    <td valign="top" width="14%" align="left">
                        <asp:Label ID="lblStatementNumber" runat="server" />
                    </td> 
                   
                    <td valign="top" width="14%" align="left">
                        <asp:Label ID="lblStatementDate" runat="server" />
                    </td>
                    <td valign="top" width="14%" align="left">
                        <asp:Label ID="lblDueDate" runat="server" />
                    </td>
                    <td valign="top" width="14%" align="left">
                        <asp:Label ID="lblBilledAMT" runat="server" />
                    </td>
                    <td valign="top" width="14%" align="left">
                        <asp:Label ID="lblOutstandingAMT" runat="server" />
                    </td>
                    <td valign="top" width="14%" align="left">
                        <asp:HyperLink ID="HyperLink1" runat="server" Text="PDF" ImageUrl="~/Images/pdficon_small.gif" Target="_blank" />
                        <asp:HyperLink ID="lnkFormat" runat="server" Text="PDF" ImageUrl="~/Images/pdficon_small.gif" Target="_blank" />
                    </td>
                </itemtemplate>
             
            </asp:datalist>
    

Open in new window


VB:

 callFunctionStr.Connection.Open()


            callFunctionStr.CommandText = "Exec [dbo].[Cogsdale_getAllBills] '" & Left(Session("AccountNumber"), 6) & "'"

            sqladapt.SelectCommand = callFunctionStr



            sqladapt.Fill(dstable)


            repeater1.DataSource = dstable
            repeater1.DataBind()

            callFunctionStr.Connection.Close()

Open in new window


Db output:

508374-108550      2074597      2013-01-15 00:00:00.000      246.48      246.48      2013-02-14 00:00:00.000      PAY    
508374-108550      2037918      2012-10-16 00:00:00.000      400.21      0      2012-11-15 00:00:00.000      PAID    
508374-108550      2005149      2012-07-17 00:00:00.000      201.87      0      2012-08-16 00:00:00.000      PAID
0
Comment
Question by:UnderSeven
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 41

Accepted Solution

by:
guru_sami earned 2000 total points
ID: 38828682
You need to eval the fields like:
 <itemtemplate>
   <td valign="top" width="14%" align="left">
       <asp:Label ID="lblStatus" runat="server" Text='<%# Eval("YourStatusFieldName") %>'/>
   </td>
    <td valign="top" width="14%" align="left">
           <asp:Label ID="lblStatementNumber" runat="server" Text='<%# Eval("YourStatementNumberFieldName") %>' />
     </td> 

---and so no

Open in new window

0
 

Author Closing Comment

by:UnderSeven
ID: 38828724
Thanks, I knew I was probably overlooking something simple.
0

Featured Post

Amazon Web Services EC2 Cheat Sheet

AWS EC2 is a core part of AWS’s cloud platform, allowing users to spin up virtual machines for a variety of tasks; however, EC2’s offerings can be overwhelming. Learn the basics with our new AWS cheat sheet – this time on EC2!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question