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

  • Thread starter Thread starter Davisro
  • Start date Start date
D

Davisro

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
 
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
 
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
 
Back
Top