Programatically reference GridView field?

Discussion in 'ASP .Net Web Controls' started by 11D.Universe, Jun 10, 2007.

  1. 11D.Universe

    11D.Universe Guest

    I've got a datafield column named RecID in a GridView named
    GridView2.

    What's the correct vb syntax to reference the data field value in the
    GridView2_SelectedIndexChanging sub?

    I'm trying to do something like:

    Protected Sub GridView2_SelectedIndexChanging(ByVal sender As Object,
    ByVal e As System.Web.UI.WebControls.GridViewSelectEventArgs) Handles
    GridView2.SelectedIndexChanging

    if RecID is NULL then cancel the SelectedIndexChange

    End Sub
    11D.Universe, Jun 10, 2007
    #1
    1. Advertising

  2. 11D.Universe

    Madison Guest

    Try
    DataBinder.Eval(e.Row.DataItem, "RecID ")


    "11D.Universe" wrote:

    > I've got a datafield column named RecID in a GridView named
    > GridView2.
    >
    > What's the correct vb syntax to reference the data field value in the
    > GridView2_SelectedIndexChanging sub?
    >
    > I'm trying to do something like:
    >
    > Protected Sub GridView2_SelectedIndexChanging(ByVal sender As Object,
    > ByVal e As System.Web.UI.WebControls.GridViewSelectEventArgs) Handles
    > GridView2.SelectedIndexChanging
    >
    > if RecID is NULL then cancel the SelectedIndexChange
    >
    > End Sub
    >
    >
    Madison, Jun 12, 2007
    #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. SimonH
    Replies:
    2
    Views:
    370
    William F. Robertson, Jr.
    Feb 10, 2005
  2. =?Utf-8?B?UGF1bA==?=
    Replies:
    14
    Views:
    1,128
    Juan T. Llibre
    May 13, 2005
  3. Replies:
    3
    Views:
    522
  4. Sound
    Replies:
    2
    Views:
    430
    Randy Webb
    Sep 28, 2006
  5. jr
    Replies:
    3
    Views:
    409
Loading...

Share This Page