i want to create wishlist when i click on heart icon of each product that product id and customer id will be store in wishliat table
i get customer id using theri login but i get product id of last product id
can you help me to get different product id every time
here is my code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BusinessLayer;
using System.IO;
public partial class wishlist : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
fillData();
}
#region Wish
protected void btnsWish_Click(object sender, EventArgs e)
{
Login.Visible = true;
wish.Visible = false;
}
#endregion
#region fillData()
private void fillData()
{
clsCategory objCategory = new clsCategory(true);
clsProductMain objProduct = new clsProductMain(true);
objCategory.getDropDownMenu();
objProduct.getCatPro();
string str = string.Empty;
string str1 = string.Empty;
int j = 0;
for (j = 0; j < objProduct.ListclsProductMain.Count; j++)
{
if (objCategory.ListclsCategory[0].CategoryID.ToString() == objProduct.ListclsProductMain[j].CategoryID.ToString())
{
if (File.Exists(Server.MapPath("images/ProductImage/" + objProduct.ListclsProductMain[j].ProductID + ".jpg")))
{
str += @"<div class='col-sm-4'>
<i id='imge' class='fa fa-heart' style='margin-left:196px;color:#c2c2c2' onclick='funPopup();getID();'></i>
<img class='imges' style='height:220px;' src='images/ProductImage/" + objProduct.ListclsProductMain[j].ProductID + ".jpg" + @"' />
<p class='sname'>" + objProduct.ListclsProductMain[j].ProductName + @"</p>
<p class='sname2'>" + objProduct.ListclsProductMain[j].MRP + @"</p>
</div>";
str1 = @" <p id='proid'>" + objProduct.ListclsProductMain[j].ProductID + @"</p>";
// str1 = objProduct.ListclsProductMain[j].ProductID.ToString();
// proid.InnerHtml=str1;
// lblid.Text = str1;
}
product.InnerHtml = str;
lblid.Text = objProduct.ListclsProductMain[j].ProductID.ToString();
}
}
}
#endregion
#region Login
protected void btn_Login_Click(object sender, EventArgs e)
{
clsCustomer objCustomer = new clsCustomer(true);
objCustomer.getCustomer();
clsWishList objWish = new clsWishList(true);
int i = 0;
string str = string.Empty;
for (i = 0; i < objCustomer.ListclsCustomer.Count; i++)
{
lblcust.Text = objCustomer.ListclsCustomer[i].CustomerId.ToString();
// Int32 idd = objCustomer.ListclsCustomer[i].CustomerId;
lblid.Visible = true;
if (objCustomer.ListclsCustomer[i].UserName == txtUserName.Text && objCustomer.ListclsCustomer[i].Password == txtPassword.Text)
{
lblLogin.Text = "Login";
lblLogin.Visible = true;
Int32 id = 0;
if (id == 0)
{
// id = objWish.Insert(Convert.ToInt32(lblcust.Text), Convert.ToInt32(lblid.Text), DateTime.Now);
wish.Visible = true;
Login.Visible = false;
}
}
else
{
lblFail.Text = "fail";
lblFail.Visible = true;
}
}
}
#endregion
}
<script>
function funPopup() {
$('#myModal').modal('show');
};
function funCloseRevel() {
$('#myModal').modal('hide');
$(".modal-backdrop").removeClass()
};
function getID() {
$("#imge").click(function () {
alert($("#proid").text());
});
}
</script>
<style>
.sname
{
padding-top: 8px;
text-align: center;
font-size: 16px;
color: black;
font-weight: 500px;
}
.sname2
{
padding-top: -4px;
text-align: center;
font-size: 16px;
color: #16be48;
}
.imges
{
display: block;
max-width: 100%;
max-height: 100%;
margin: auto; /* margin-top:10px;*/
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:Label ID="lblLogin" runat="server" Visible="false"></asp:Label>
<asp:Label ID="lblFail" runat="server" Visible="false"></asp:Label>
<asp:Label ID="lblid" runat="server" Visible="false"></asp:Label>
<asp:Label ID="lblcust" runat="server" Visible="false"></asp:Label>
<div id="wish" runat="server" class="container">
<div id="product" runat="server" style="margin: 0 20px;">
</div>
</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="basicModal"
aria-hidden="true">
<div class="modal-dialog" style="width: 25%;">
<div class="modal-content">
<a href="#" class="btn-close" onclick="funCloseRevel();">
<img src="images/Close.png" class="btn_close" title="Close Window" data-dismiss="modal"
aria-hidden="true" alt="Close" style="float:right" /></a>
<div id="Login" runat="server">
<center>
<h2>
Login</h2>
<table class="tablePopup" cellspacing="0">
<tr>
<td align="left" style="padding-left: 15px;">
User Name:
</td>
<td>
<asp:TextBox ID="txtUserName" CssClass="form-control txt" runat="server" Width="110px"></asp:TextBox>
</td>
</tr>
<tr>
<td align="left" style="padding-left: 15px;">
Password:
</td>
<td>
<asp:TextBox ID="txtPassword" CssClass="form-control txt" runat="server" Width="110px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Button ID="btn_Login" Text="Login" runat="server" OnClick="btn_Login_Click" />
</td>
</tr>
</table>
</center>
</div>
</div>
</div>
</div>
</form>
</body>
</html>