#1
  1. No Profile Picture
    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
  3. Contributing User
    ASP Skiller (1500 - 1999 posts)

    Join Date
    Mar 2005
    Location
    Columbus, OH
    Posts
    1,584
    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

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

IMN logo majestic logo threadwatch logo seochat tools logo