Click here to Skip to main content
15,891,905 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have this logic/plan in mind and would like to have some advice on how to implement it. I have researched alot on it but could not find a suitable one that suit my context. I have a few Buttons in my .aspx code and would like to check for countClicks for those buttons. Therefore, is there a method to check for button count clicks using code behind (meaning writing codes in the .cs) instead of writing count clicks in javascript? What i am doing is to restrict the user from clicking more than 2 buttons (they can only click a maximum of 2 buttons out of the 5 buttons available).

I included a
C#
commandName = "Select"
for each of the 5 buttons in order to check the number of button click the user presses. Am i on the right track?
How do i go about achieving this?

Thanks for your help!
Posted

1 solution

Some Suggestion

1.Just disable the button after click....if more than two buttons are disabled then prompt to user.
2.Use a hiddenfield or viewstate to keep the button click count and update the click count from code behind... Check for the count in viewstate/hiddenfield then prompt to user it its more than two
3. Use Check Boxes instead of Button so that user have the option to undo the selection
 
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