Click here to Skip to main content
15,916,693 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a asp gridview and inside grid view i am populating checkboxes.

My requirement is that, Initially the check boxes are hidden and on click it should be visible and checked.
Following is my code.
<asp:GridView runat="server" ID="gvOifList" RowStyle-CssClass="rowHover" CssClass="gridviewdiv" OnRowCreated="OnRowCreated" AutoGenerateColumns="false" OnRowCommand="lnkWebURL_Click" OnRowDataBound="gvOifList_RowDataBound" GridLines="None" AlternatingRowStyle-BackColor="#D8D8D8" ShowHeader="false">
<asp:Checkbox ID="chbCopy" runat="server"  UseSubmitBehavior="false" Style="" CausesValidation="false"  />

I am doing this development for iOS.
Updated 28-Aug-14 3:51am
[no name] 28-Aug-14 7:10am    
If the checkbox is hidden, how would you expect someone to see it to be able to check it to make it visible?
Member 10284541 28-Aug-14 8:08am    
User know the place where to click...
If user click on that particular place the check box should be visible.
[no name] 28-Aug-14 8:52am    
It's hidden. You need to find an alternate way or come up with some reasonable requirement.
ZurdoDev 28-Aug-14 7:39am    
1. Reply to comment so that the user is notified instead of adding a new comment to your own question.
2. You'll want to use javascript to do it.
Member 10284541 28-Aug-14 8:20am    
Can you please guide me the way to do it using java script.

add me on facebook

on the asp subscribe to the mouse click event
// CheckBox name is "CB"

OnMouse_click(Object sender, MouseEventArgs e)
if( CB.Location.X >= e.X && CB.Location.Y >= e.Y && CB.Location.X+CB.Width <= e.X && CB.Location.Y+CB.Height <= e.Y)
//if the mouse is over the checkbox make it visable and check it
CB.visable = true;
CB.enabled = true;
CB.checked = true;

//on the checkbox sub scribe to the on checked changed event
OnCheckChange_click(Object sender, EventArgs e)
if(CB.checked == true)
CB.visable = false;

ignore this below lol
| \/\/\/\/ |
|  \/\/\/  |
|   \/\/   |
|    \/    |
|    /\    |
|   /\/\   |
|  /\/\/\  |
| /\/\/\/\ |
Share this answer
wrap your checkbox inside of a div kind of like the following:

<div id="divCheckBox">
    <input type="checkbox" id="chbCopy" name="vehicle" style="visibility: hidden;">

you will want to use the visibility style otherwise there won't be any space on the screen for the user to click into and when you display the checkbox (after being hidden) you will get the screen to shift on you. Since you are doing this for an iOS device that small shift could be a huge UX issue.

in your client side javascript code try the following: (assume you are using jQuery)

$("#divCheckBox").click(function() {
    if ("hidden" == $("#chbCopy").css("visibility")) {
        $("#chbCopy").css("visibility", "");
        $("#chbCopy").prop("checked", true);

To save yourself all the DOM searches you will of course want to save the checkbox element to a var but this was just to demo all that is happening.
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