Selecting Datagrid Row by Clicking Anywhere

Discussion in 'ASP .Net Web Controls' started by sa5webber, Feb 15, 2005.

  1. sa5webber

    sa5webber Guest

    I'm trying to setup a datagrid in a custom control where I can select
    the row with the Select column hidden and have it call the
    "SelectIndexChanged" event. In the "SelectIndexChanged" I just want to
    populate a textbox with an item out of the selected row.

    I've implemented what seems to be the standard approach like what's
    shown below to accomplishing this and the event works when selecting
    the select column link, when I make it visible. However I can't get it
    to work when selecting other parts of the row with the select column
    visible or not. What am I missing or is there a better way to
    accomplish what I'm trying to do?

    Thanks

    Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, _
    ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) _
    Handles DataGrid1.ItemDataBound
    Dim itemType As ListItemType = e.Item.ItemType
    If ((itemType = ListItemType.Pager) Or _
    (itemType = ListItemType.Header) Or _
    (itemType = ListItemType.Footer)) Then
    Return
    Else
    Dim button As LinkButton = _
    CType(e.Item.Cells(0).Controls(0), LinkButton)
    e.Item.Attributes("onclick") = _
    Page.GetPostBackClientHyperlink(button, "")
    End If
    End Sub
     
    sa5webber, Feb 15, 2005
    #1
    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. =?Utf-8?B?U3RldmVuIFc=?=

    Selecting Rows by Clicking Anywhere

    =?Utf-8?B?U3RldmVuIFc=?=, Feb 15, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    358
    =?Utf-8?B?U3RldmVuIFc=?=
    Feb 15, 2005
  2. .NETn00b
    Replies:
    1
    Views:
    984
    Eliyahu Goldin
    Nov 28, 2005
  3. misiek
    Replies:
    0
    Views:
    2,283
    misiek
    Feb 20, 2006
  4. .NETn00b

    Clicking Anywhere in DataGrid Row to Check CheckBox

    .NETn00b, Nov 28, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    173
    .NETn00b
    Nov 28, 2005
  5. Replies:
    3
    Views:
    82
Loading...

Share This Page