Solved

populate datalist from sql in asp.net

Posted on 2013-01-28
2
273 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
2 Comments
 
LVL 41

Accepted Solution

by:
guru_sami earned 500 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

746 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now