Solved

populate datalist from sql in asp.net

Posted on 2013-01-28
2
276 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

821 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