ASP.Net Datagrid get Cell Contents on mouse click or mouse down

Discussion in 'ASP .Net' started by Davisro, Apr 23, 2004.

  1. Davisro

    Davisro Guest

    I would like to get the cell contents of an asp.net datagrid when the mouse
    is down? Mouse Click, cell click etc...


    Is there a way to get this?



    Thanks,

    Rog
    Davisro, Apr 23, 2004
    #1
    1. Advertising

  2. about the easiest way to do this is to place the items ahead of time, tied
    to the mousedown event handler from the itemdatabound using the attributes
    of the cell object. Once the data is streamed to the page, you can access
    the data because it is inside the page itself

    --
    Regards,
    Alvin Bruney
    [ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
    Got tidbits? Get it here... http://tinyurl.com/27cok
    "Davisro" <NA> wrote in message
    news:...
    >I would like to get the cell contents of an asp.net datagrid when the mouse
    > is down? Mouse Click, cell click etc...
    >
    >
    > Is there a way to get this?
    >
    >
    >
    > Thanks,
    >
    > Rog
    >
    >
    Alvin Bruney [MVP], Apr 23, 2004
    #2
    1. Advertising

  3. Davisro

    Jim Corey Guest

    Rog,

    In the ItemDataBound event of the datagrid you can do something like
    this:

    If e.Item.ItemType = ListItemType.Item Then
    e.Item.Cells(1).Attributes.Add("onclick", "alert('hi')")
    End If

    You might also add ListItemType.AlternatingItem (this event also fires
    for the header, and you don't want it there).

    You could add in variables as needed.

    HTH,
    Jim



    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Jim Corey, Apr 23, 2004
    #3
    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. Cory D.
    Replies:
    1
    Views:
    675
    =?Utf-8?B?dGVuemVlbC4=?=
    Jul 28, 2004
  2. Craig G
    Replies:
    1
    Views:
    521
    Eliyahu Goldin
    Feb 1, 2005
  3. Carl Gilbert
    Replies:
    3
    Views:
    1,109
    Beauregard T. Shagnasty
    May 21, 2004
  4. Carl Gilbert

    Cell/td on mouse click event using ASP

    Carl Gilbert, May 19, 2004, in forum: ASP General
    Replies:
    1
    Views:
    309
    Carl Gilbert
    May 19, 2004
  5. Daniish
    Replies:
    2
    Views:
    240
    Thomas 'PointedEars' Lahn
    Jun 13, 2008
Loading...

Share This Page