Solved

populate datalist from sql in asp.net

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

617 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