Notices

Great community. Great ideas.

Welcome to ASP/Free, a community dedicated to helping beginners and professionals alike in improving their knowledge of Microsoft's development and administration technologies. Sign up today to gain access to the combined insight of tens of thousands of members.

Thread: Problem With List View

Results 1 to 2 of 2
Share This Thread →
  1. #1
    ggauravbhandari is offline Registered User
    Join Date
    Nov 2012
    Location
    Indore
    Posts
    1
    Rep Power
    0

    Problem With List View

    In totl i got total price but i am not able to display it... Loop is not go in Else Loop.............

    <asp:ListView ID="lstViewCart_History" runat="server" OnPreRender="lstViewCart_History_PreRender" OnItemDataBound="lstViewCart_History_OnItemDataBou nd" ItemPlaceholderID="PlaceHolder1">
    <LayoutTemplate>
    <table width="40%">
    <thead>
    <tr>
    <td>
    <%# Eval("order_pid")%>
    </td>
    </tr>
    <tr>
    <td>
    </td>
    </tr>
    <tr>
    <td>
    </td>
    </tr>
    </thead>
    <tbody>
    <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
    </tbody>
    <tr>
    <td colspan="8" align="right">
    Total Amount
    </td>
    <td colspan="2" align="left"><br />
    $<asp:Label ID="lblw" runat="server" Text=""></asp:Label>
    </td>
    </tr>
    </table>
    </LayoutTemplate>
    <ItemTemplate>
    <table>
    <tr>
    <td>
    <table>
    <tr>
    <td>
    Book Name
    </td>
    <td>
    Author
    </td>
    <td>
    ISBN
    </td>
    <td>
    Order Number
    </td>
    <td>
    Order Date
    </td>
    <td>
    Quantity
    </td>
    <td>
    Price
    </td>
    <td>
    Total Price
    </td>
    </tr>
    <tr>
    <td>
    <%# Eval("cartdetail_pname")%>
    </td>
    <td>
    <%# Eval("cartdetail_author")%>
    </td>
    <td>
    <%# Eval("cartdetail_isbn")%>
    </td>
    <td>
    <%# Eval("order_pid")%>
    </td>
    <td>
    <%# Eval("order_date")%>
    </td>
    <td>
    <%# Eval("cartdetail_qty")%>
    </td>
    <td>
    $<%# Eval("cartdetail_price")%>
    </td>
    <td>
    $<asp:Label runat="server" ID="total_price" Text='<%#Eval("total_price")%>'></asp:Label>
    </td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    </ItemTemplate>

    </asp:ListView>

    protected void lstViewCart_PreRender(object sender, EventArgs e)
    {
    Label lblTot = this.ListView1.FindControl("lblGrandTotal") as Label;
    if (lblTot == null)
    {

    }
    else
    {
    lblTot.Text = totl.ToString();
    }
    }

    Thanks for giving time to read my problem and also for your valuable suggestions.

    Gaurav Bhandari

  2. #2
    gk53's Avatar
    gk53 is offline Contributing User
    Join Date
    Mar 2005
    Location
    Columbus, OH
    Posts
    1,535
    Rep Power
    278
    first at all it is not asp it is dotnet question and your code in c#. Classic asp forum is asp and code should be in vbscript...
    your problem is you should move your code to OnItemDataBound event or just bind data and after that look throw your view and apply value
    GK
    __________________________________________________ _____
    if you found this post is useful click Give Rep button (bottom side on this reply ) and agree

Share This Thread →

Become Part of This Conversation

Join NowFor Free!

Similar Threads

  1. View list inside textarea
    By hantz85 in forum ASP Development
    Replies: 2
    Last Post: November 7th, 2007, 03:20 AM
  2. How to add more record without view the list?
    By awiezzz in forum ASP Development
    Replies: 5
    Last Post: December 5th, 2006, 06:14 AM
  3. List view print
    By kumar-pln in forum Visual Basic Programming
    Replies: 0
    Last Post: December 22nd, 2005, 04:08 AM
  4. View Table Fields in a list box
    By RSMan in forum Microsoft Access Help
    Replies: 4
    Last Post: February 22nd, 2005, 12:54 PM
  5. list view
    By gnanadurai in forum Visual Basic Programming
    Replies: 1
    Last Post: January 29th, 2004, 05:42 AM

ASP Free Advertisers and Affiliates