AspdotnetCodes.com
Search
Articles
Books
Resources
Asp.Net News
Downloads
Free Tech Magazines
Asp.Net Web Hosting
Archives
Softwares
Newsletter
Suggest Us
Link to Us
Feeds Subscription
Articles
Questions & Answers
Tips & Tricks
 Datagrid Checkboxe's Select all javascript function called on second click only
Posted by Selva on  2/9/2009 3:08:14 AM Category: Asp.Net 2.0
Add to my favorites
Email to friend
In my datagrid, i am having checkboxes, if the user select check all, all check boxes selected, it is works find in firefox and chrome browsers, but in ie browser, it is selected on my second click only. Please send your suggestions for this.

This datagrid is placed in contedplaceholder's update panel.


Thanks in Advance

Post Your Reply Post New Question

 Viewer's Reply
Datagrid Checkboxe's Select all javascript function called on second click only
Answered By Kunwar on 3/4/2009 4:48:58 AM
use this script for selectAll functionality
<script language='javascript'>
function CheckCheckAll(fmobj,ids)
{

var elem = document.getElementById(ids).form.id;
var len=document.getElementById(elem).elements.length;

var chkID = document.getElementById(ids).id;

if(document.getElementById(ids).checked)
{
for (var i=0;i<len;i++)
{

var e = fmobj.elements[i];
if (e.type=='checkbox')
{
e.checked=true;
}

}
}
else
{

for (var i=0;i<len;i++)
{

var e = fmobj.elements[i];
if (e.type=='checkbox')
{

e.checked=false;

}

}

}


}

</script>

<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox ID="chkAllScreenId" runat="server" Text='All' AutoPostBack="False"
onclick="javascript:CheckCheckAll(this.form,this.id);" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkScreenId" runat="server" />
</ItemTemplate>
</asp:TemplateField>


From:- Kunwar
http://kprataps.blogspot.com
 
Post Your Reply If you still have problem, post it again under this reply for better response.

 
Sponsored by
Many .NET teams are underperforming, is yours?
The PHP Anthology: 101 Essential Tips, Tricks & Hacks, 2nd Edition - Free 207 Page Preview!
No Nonsense XML Web Development With PHP - Free 146 Page Preview!