checkbox in grid control

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Dec 2008
Posts: 30
Reputation: sonakrish is an unknown quantity at this point 
Solved Threads: 1
sonakrish sonakrish is offline Offline
Light Poster

checkbox in grid control

 
0
  #1
Jan 22nd, 2009
If i select checkbox in grid header template i shld get all my checkbox in item template to be checked.. can any one help me to do.
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 104
Reputation: Aneesh_Argent is an unknown quantity at this point 
Solved Threads: 18
Aneesh_Argent Aneesh_Argent is offline Offline
Junior Poster

Re: checkbox in grid control

 
0
  #2
Jan 22nd, 2009
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 370
Reputation: greeny_1984 is an unknown quantity at this point 
Solved Threads: 29
greeny_1984's Avatar
greeny_1984 greeny_1984 is offline Offline
Posting Whiz

Re: checkbox in grid control

 
0
  #3
Jan 22nd, 2009
  1.  
  2. chkh.Attributes.Add("onclick", "javascript:return SelectAll(this,'"+ dglist.ClientID +"');");
  3.  
  4. //dglist is gridview
  5. function SelectAll(id,dg)
  6. {
  7.  
  8. var grid = $get(dg);
  9. var cell;
  10. var txt;
  11.  
  12. if (grid.rows.length > 0)
  13. {
  14. //loop starts from 1. rows[0] points to the header.
  15. for (i=1; i<grid.rows.length; i++)
  16. {
  17. var inputs = grid.getElementsByTagName("input");
  18. if (inputs.length>0)
  19. {
  20. //loop starts from 1. rows[0] points to the header.
  21. for (i=1; i<inputs.length; i++) //if childNode type is CheckBox
  22. {
  23.  
  24.  
  25. if(inputs[i].type=="checkbox")
  26. {
  27.  
  28. var chk=$get(inputs[i].id);
  29.  
  30. if(id.checked == true)
  31. {
  32.  
  33. chk.checked=true;
  34.  
  35.  
  36.  
  37. }
  38. else
  39. {
  40. chk.checked=false;
  41.  
  42.  
  43. }
  44.  
  45.  
  46. }
  47. }
  48. }
  49.  
  50. }
  51. }
  52. }
If u r query is achieved,mark the thread as solved

Live and Let Live
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for ASP.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC