how to display count of add to cart in masterpage

Posted by Ramakrishna188 under ASP.NET on 6/4/2012 | Points: 10 | Views : 2322 | Status : [Member] | Replies : 3
hi all,
how to display count of add to cart in masterpage? pls reply me
please send me.

Thankyou.




Responses

Posted by: Shubham on: 6/4/2012 [Member] Starter | Points: 25

Up
0
Down
simply you can increase of a variabie +1 and show on lable

variable increase the value on add to cart button....
write function like this
if(button_click== true)
{
lable=+1....like
}
else
{
nothing (or your case)
}

Thanks&Regards:-
Shubham Choudhary
Software Engineer
www.facebook.com/shubham.kunar

Ramakrishna188, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ajay.Kalol on: 6/5/2012 [Member] Starter | Points: 25

Up
0
Down
You have to access master Page control from content Page.
Visit this for more detail
http://msdn.microsoft.com/en-us/library/xxwa0ff0.aspx

Ajay
ajaypatelfromsanthal.blogspot.in

Ramakrishna188, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: .Netlearner on: 6/5/2012 [Member] Starter | Points: 25

Up
0
Down
<%@ MasterType virtualPath="~/MasterPage.master"%>

include this after the page directive so that you can access the master page controls.

in the code behind file access the label/any ctrl of the master page and set the count of the cart to that label when there are some changes.eg.whenever u add a new item to ur cart/whenever u remove an item from ur cart.The value of ur cart must be updated.better to create a user defined funtion in which u update the cart value and call in the page load event.

Following Sample Code Denotes how to access the masterpage control from the child page,

   cmd = new SqlCommand("Select Quantity from MyCart", con);

dr = cmd.ExecuteReader();
while (dr.Read())
{
Label mlabelcart = (Label)Master.FindControl("lblcartvalue");
mlabelcart.Text = "(" + dr["Quantity"].ToString() + ")";
}
dr.Close();


Ramakrishna188, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response