Accessing controls in template column with JavaScript

Discussion in 'ASP .Net Datagrid Control' started by Peter Cresswell, Jul 16, 2003.

  1. 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
     
    Peter Cresswell, Jul 16, 2003
    #1
    1. Advertising

  2. 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("checkbox") > -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" <> 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
    >
    >
     
    Cristian Suazo, Jul 16, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dexter
    Replies:
    1
    Views:
    440
    Eliyahu Goldin
    Jan 18, 2005
  2. Ken Varn
    Replies:
    1
    Views:
    994
    Ken Varn
    Aug 19, 2005
  3. Vikram

    accessing template column controls

    Vikram, Dec 15, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    401
    Karl Seguin
    Dec 15, 2005
  4. Charleees
    Replies:
    2
    Views:
    8,280
    Eliyahu Goldin
    Jun 20, 2006
  5. Deepak

    Accessing Textbox inside a Template column using javascript

    Deepak, Aug 6, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    166
    Saravana
    Aug 6, 2003
Loading...

Share This Page