Click here to Skip to main content
15,893,381 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to get checkbox selection time which is to be saved in table and also restricted the checkbox not to excedd the time limit
Posted
Comments
Arun Jacob 22-Sep-11 5:40am    
Your question is not clear. It would be great if you give more details.

Hi,

Here I write some code to restrict selection

HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
    <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script language ="javascript" >
        var tim = 500;
        var tmp;
        function f1(tagid) {
           
            if (parseInt(tim) == 0) {
                document.getElementById(tagid).checked = false;
            }
        }
        function strt() {
            if (parseInt(tim) > 0) {
                tim = parseInt(tim) - 1;
                tmp = setInterval("strt()", 100);
            }
            else {
                tim = 0;
            }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <input type ="button" value ="start" id="btnstart" onclick="strt()" />
        <input type="checkbox" id="check1" value="option1" onclick="f1(this.id)" />
        <input type="checkbox" id="Checkbox2" value="option2" onclick="f1(this.id)"  />
        <input type="checkbox" id="Checkbox3" value="option3" onclick="f1(this.id)"  />
        <input type="checkbox" id="Checkbox4" value="option4" onclick="f1(this.id)"  />
       
    </div>
    </form>
</body>
</html>


try this it can helps you


All the Best
 
Share this answer
 
thanx for the help
but i dont want it restrict the entry but just to save the checkbox checked time into my datagrid
 
Share this answer
 
Comments
André Kraak 22-Sep-11 7:58am    
If you have a question about or comment on the given solution use the "Have a Question or Comment?" option beneath the solution. When using this option the person who gave the solution gets an e-mail message and knows you placed a comment and can respond if he/she wants.

Please move the content of this solution to the solution you are commenting on and remove the solution. Thank you.
Muralikrishna8811 22-Sep-11 8:05am    
then write code in checked changed event

use this line System.DateTime.Now.ToShortTimeString();
Set the property AutoPostBack = "true", and bind an event handler like checkbox1_CheckedChanged, where you can get the time of the checkbox checked.

You can also disable the control after it is checked, to restrict the user to click the same next time.
 
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