I am trying to make a div
tag clickable . Following is the markup for it :
<asp:Repeater ID="rptr" runat="server">
<ItemTemplate>
<div class="col-lg-4 col-md-4 col-sm-4 mb">
<div class="content-panel pn">
<div id="profile-01" style='<%# "background-image : url("+Eval("Photo").ToString()+") " %>'></div>
<div class="profile-01 centered" onclick="location.href='ProductDetails.aspx?ID=Eval("VendorItemID")' ">
<p><%# Eval("Name") %></p>
</div>
<div class="centered">
<h5><i class="fa fa-gift"></i><br/><%# Eval("Description") %></h5>
</div>
</div><! --/content-panel -->
</div><! --/col-md-4 -->
</ItemTemplate>
</asp:Repeater>
My C# code:
if (!IsPostBack)
{
VendorItemLogic vendorItem = new VendorItemLogic();
DataTable dt = vendorItem.populateProducts(Convert.ToInt32(Request.QueryString["ID"]));
rptr.DataSource = dt;
rptr.DataBind();
}
Now when I use onClick
event of the div
tag i get an error when i am using Eval()
tag saying : The attribute name must be followed by an equal(=) sign and a value. If the value is in quotation marks, the quotation marks must match.
And is it the best way to navigate to a different page using location.href
property?
The purpose I want that ID in the Eval tag is because i want to access that ID on the other page and display that particular product's details .