Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Accessing controls in template column with JavaScript

Reply
Thread Tools

Accessing controls in template column with JavaScript

 
 
Peter Cresswell
Guest
Posts: n/a
 
      07-16-2003
Hi Guys & Gals,

Is it possible to access controls (e.g. a CheckBox) within a template column
in a datagrid with JavaScript?

I would like to count the number of rows in my datagrid with checked boxes
on the client side, i.e. without a post back.

Anybody know how to do this?
I would also like to do a hotmail style select all on the client side. Is
this possible with a datagrid?

Thanks in advance!

Peter


 
Reply With Quote
 
 
 
 
Cristian Suazo
Guest
Posts: n/a
 
      07-16-2003
Could this be something?

<html>
<body>

<script language='Javascript'>
<!--
function CountCheck(){
var counter = 0;
var counter_checked = 0;
for(i=0; i < document.forms(0).length; i++){
if (document.forms(0).elements(i).type.indexOf("check box") > -1){
if (document.forms(0).elements(i).checked == true) counter_checked++;
counter++;
}
}
alert("You have " + counter + " checkboxes, " + counter_checked + " are
checked...")
}
//-->
</script>

<form>
<input type="checkboX"><br>
<input type="checkbox"><br>
<input type="checkbox"><br>
<input type=button onClick="CountCheck();" value="Count checkboxes"/>
</form>

</body>
</html>

Cheers
Cristian



"Peter Cresswell" <p-> wrote in message
news:...
> Hi Guys & Gals,
>
> Is it possible to access controls (e.g. a CheckBox) within a template

column
> in a datagrid with JavaScript?
>
> I would like to count the number of rows in my datagrid with checked boxes
> on the client side, i.e. without a post back.
>
> Anybody know how to do this?
> I would also like to do a hotmail style select all on the client side. Is
> this possible with a datagrid?
>
> Thanks in advance!
>
> Peter
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
setting Column width of Template Column in Datagrid.. Charleees ASP .Net 2 06-20-2006 12:52 PM
accessing template column controls Vikram ASP .Net 1 12-15-2005 12:47 PM
DataGrid loses view state if first column is a template column. Ken Varn ASP .Net 1 08-19-2005 02:54 PM
how to know if a datagrid column is a template column? Dexter ASP .Net 1 01-18-2005 01:45 PM
Accessing Textbox inside a Template column using javascript Deepak ASP .Net Datagrid Control 1 08-06-2003 11:29 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57