Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello, this is Vikash Gohil.

I have created a Web application using ASP.net.

In this I have used GridView, with a checkbox for selection in each row.

Also I have given a checkbox in header for selecting all the checkboxes.

The problem is everything works fine at my PC and in our office.

But at one the client places, the select all checkbox does not work.

I have checked the Javascript setting, it is all ok.

What else do I need to check/enable for this to work.

Anyone have faced such a problem, please reply.

Awaiting a reply.

Thanks in advance.
Posted
Comments
demouser743 24-Mar-12 5:21am    
Lot of articles available on this , why don't you go through them.
member60 24-Mar-12 5:27am    
how did you added check all functionality ? i mean to say using javascript or something else...

 
Share this answer
 
Thanks for your reply,

But I don't want to know How to do the Select All functionality.

I have done that and is working fine at my office and at other client side as well.

it is only that, it is not working at a couple of clients.

So I wanted to know whether there is any other setting we need to do in IE to enable it in addition to enabling Javascript.
 
Share this answer
 
Comments
Nelek 24-Mar-12 6:52am    
If you use "Have a question or comment" below the text of the person you want to speak with (as I am now doing), he will get a e-mail informing of the comment. Just adding an answer as you did is not the best way.
hi you! you can using code snipet below :d hope this help you
VB
'Sub checkall
    Public Sub MakeChecked(ByVal GridView As DataGridView, ByVal ColumnName As String)
        Dim UnCheckedItems = From Rows In GridView.Rows.Cast(Of DataGridViewRow)() Where CBool(Rows.Cells(ColumnName).Value) = False
        For Each item In UnCheckedItems
            item.Cells(ColumnName).Value = True
        Next
    End Sub
    'Sub uncheckall
    Public Sub MakeUnChecked(ByVal GridView As DataGridView, ByVal ColumnName As String)
        Dim UnCheckedItems = From Rows In GridView.Rows.Cast(Of DataGridViewRow)() Where CBool(Rows.Cells(ColumnName).Value) = True
        For Each item In UnCheckedItems
            item.Cells(ColumnName).Value = False
        Next
    End Sub
 
Share this answer
 
XML
hey
 try this.
<pre lang="cs">function CheckAll(checkboxId, index) {
            var grid = document.getElementById('GridView1');

            if (grid.rows.length &gt; 0) {
                //loop starts from 1. rows[0] points to the header.
                for (i = 1; i &lt; grid.rows.length; i++) {
                    //get the reference of first column
                    if (index &gt; 0) {
                        cell = grid.rows[i].cells[index];
                        for (j = 0; j &lt; cell.childNodes.length; j++) {
                            //if childNode type is CheckBox
                            if (cell.childNodes[j].type == &quot;checkbox&quot;) {
                                //assign the status of the Select All checkbox to the cell checkbox within the grid
                                cell.childNodes[j].checked = checkboxId.checked;
                            }
                        }

                    }
                }
            }
        }</pre>

//Calling of function

<pre lang="xml">&lt;HeaderTemplate&gt;
                                                                                &lt;asp:CheckBox ID=&quot;chkHeader&quot; Text=&quot;Check&quot; runat=&quot;server&quot; ToolTip=&quot;Check All&quot; onclick=&quot;return CheckAll(chkHeader,1(columnNo));&quot; /&gt;
                                                                            &lt;/HeaderTemplate&gt;</pre>

This works for me
try and give replay
Best Luck
 
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