Access Rows of a datagrid

Discussion in 'ASP .Net Datagrid Control' started by scott.loomis@gmail.com, Mar 16, 2006.

  1. Guest

    I am not sure if this is the best place to post this.

    I have an ASP.NET Datagrid control that I am using. I have been trying
    to figure out if it is possible to select a row client side on page
    load, i know about the datagrid selectedindex, but that does not
    provide me with the functionality I am looking for. I have a
    javascript function that catches a click event of the row

    function onRowClick(row)
    {
    //Do something
    }


    Now that works fine if a user clicks on the datagrid, because my rows
    reference the function <tr align="Center" onclick="onRowClick(this)">

    I am looking for is a way to simulate a click on the first row on
    page load via javascript.

    My grid is named dgrList, here is the grid

    <asp:datagrid id="dgrList" runat="server" Width="448px"
    BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px"
    BackColor="White" CellPadding="3" GridLines="Horizontal"
    autogeneratecolumns="False">


    Now when I try to run something like
    onRowClick(document.frmRemoteScan.dgrList.rows(0));

    I get the message that dgrList is null or not an object, and when I
    loop throught the elements in my form, dgrList is not one of them(yes
    it is between the form tags).

    My question, is there a way to reference the created table via
    javascipt? Or does anyone have a way to simulate the row clcik via
    javascript
     
    , Mar 16, 2006
    #1
    1. Advertising

  2. Guest

    I figured this out, and wanted to help anyone that might stumble on
    this post

    try document.getElementById('dgrList').rows
     
    , Mar 20, 2006
    #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. Subba Rao via DotNetMonster.com

    script for moving rows up and down and traverse thru rows of HTML table

    Subba Rao via DotNetMonster.com, Mar 19, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    8,249
    Subba Rao via DotNetMonster.com
    Mar 19, 2005
  2. helpful sql
    Replies:
    0
    Views:
    824
    helpful sql
    May 19, 2005
  3. Arjen Hoekstra
    Replies:
    0
    Views:
    567
    Arjen Hoekstra
    Aug 2, 2005
  4. Jason James

    Rows the rows of a grid view?

    Jason James, Aug 10, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    402
    Jason James
    Aug 10, 2006
  5. VijayRama
    Replies:
    2
    Views:
    2,336
    Gregory A. Beamer
    Oct 12, 2009
Loading...

Share This Page