- Total Members: 220,321
- Threads: 525,398
- Posts: 977,016
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.
-
November 22nd, 2012, 05:39 AM
#1
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
-
November 22nd, 2012, 11:49 AM
#2
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 scale

(right side on this reply ) and agree
Similar Threads
-
By hantz85 in forum ASP Development
Replies: 2
Last Post: November 7th, 2007, 03:20 AM
-
By awiezzz in forum ASP Development
Replies: 5
Last Post: December 5th, 2006, 06:14 AM
-
By kumar-pln in forum Visual Basic Programming
Replies: 0
Last Post: December 22nd, 2005, 04:08 AM
-
By RSMan in forum Microsoft Access Help
Replies: 4
Last Post: February 22nd, 2005, 12:54 PM
-
By gnanadurai in forum Visual Basic Programming
Replies: 1
Last Post: January 29th, 2004, 05:42 AM