TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
arsalan jibran
NA
22
5.7k
asp inline tags / code render blocks
Mar 13 2018 10:18 AM
i am using code render blocks in asp.net (visual studio 2010).
here is the code:
this class gets Products name ,id,price,image
public class Products
{
public string id { get; set; }
public string name { get; set; }
public string price { get; set; }
public string img { get; set; }
public Products(string id, string name, string price, string img)
{
this.id = id;
this.name = name;
this.price = price;
this.img = img;
}
}
this is the view code of aspx.webpage where class Product object is passed in the list
public partial class _Default : System.Web.UI.Page
{
public List<Products> products_list = new List<Products>();
protected void Page_Load(object sender, EventArgs e)
{
}
}
here is the source of webpage where i used this code block
<%foreach (var product in products_list)
{ %>
<div class="col-md-3 col-md2">
<div class="col-md1 simpleCart_shelfItem">
<a href="web/single.html">
<img class="img-responsive" src="<%=product.img%>" alt=""/>
</a>
<h3><a href="web/single.html"><%=product.name %></a></h3>
<div class="price">
<h5 class="item_price"><%=product.price %></h5>
<a href="#" class="item_add">Add To Cart</a>
<div class="clearfix"> </div>
</div>
</div>
</div>
<%} %>
the problem is on the img tag in source i have given <%=product.img%>
here product.name and product.price is getting shown as a class Product object correctly
although in image source <%= (here) product.img%> not showing as Product object...
Attachment:
WebApplication1.rar
Reply
Answers (
0
)
Control 'ContentPlaceHolder1_txtname' of type 'TextBox'
How do i export data to excel file in memory and download it