Click here to Skip to main content
15,888,401 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I am working on search module.after search when I am adding that item in my cart the button become Enable=false.
the problem is when this page is reloaded for same search item button Enable become true.
I want to keep that button enable =false.
Thanks
Posted
Updated 27-Aug-13 19:30pm
v2
Comments
Prasad Khandekar 28-Aug-13 1:40am    
You can do this on server side as well as on client side using javascript.

On the server side While rendering a page you will have information about the items and the shopping cart. You can use this to disable the button if itme being rendered is already present in the shopping cart.

Alternatively You can output the shopping cart as a JSON array. Then while looping through this array locate the corrosponding item container on page and disable the button in that container.

Please see the Javascript demo (http://jsfiddle.net/kyMf7/)

Regards,

1 solution

Check if you used if(!IsPostBack) condition in your page load or not...

C#
protected void Page_Load(object sender, EventArgs e)
{
     if (!IsPostBack)
     {
          btnSubmit.Enabled = true;
     }
}


I am assuming you haven't used and just used Enabled=true;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900