Get Gridview current field value

Discussion in 'ASP .Net' started by Mark B, Jul 1, 2010.

  1. Mark B

    Mark B Guest

    I have a Gridview template field 'Color'.

    I want to set its Text value to the string result of the following function:

    <%=fGetColorStringFromCounterIDLookup(intCurrentCounterID) %>

    where intCurrentCounterID is the value of the particular row's field value
    for the CounterID.

    How can I pass the current CounterID number to that function?

    I know <% #Eval(CounterID) %> gets the current CounterID but haven't been
    able to set the syntax to pass that result to the function.
    Mark B, Jul 1, 2010
    #1
    1. Advertising

  2. Mark B

    Mark B Guest

    Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As
    System.Web.UI.WebControls.GridViewRowEventArgs) Handles
    GridView1.RowDataBound

    If e.Row.RowType = DataControlRowType.DataRow Then
    e.Row.Cells(6).Text = GridView1.DataKeys(e.Row.RowIndex).Value
    End If

    End Sub


    "Mark B" <> wrote in message
    news:...
    >I have a Gridview template field 'Color'.
    >
    > I want to set its Text value to the string result of the following
    > function:
    >
    > <%=fGetColorStringFromCounterIDLookup(intCurrentCounterID) %>
    >
    > where intCurrentCounterID is the value of the particular row's field value
    > for the CounterID.
    >
    > How can I pass the current CounterID number to that function?
    >
    > I know <% #Eval(CounterID) %> gets the current CounterID but haven't been
    > able to set the syntax to pass that result to the function.
    >
    >
    >
    Mark B, Jul 1, 2010
    #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. AAJ
    Replies:
    0
    Views:
    614
  2. Joe Reiss

    Gridview - Accessing a field value in current row

    Joe Reiss, Jan 3, 2006, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    309
    Teemu Keiski
    Jan 4, 2006
  3. Sound
    Replies:
    2
    Views:
    430
    Randy Webb
    Sep 28, 2006
  4. VUNETdotUS
    Replies:
    25
    Views:
    442
    Thomas 'PointedEars' Lahn
    Nov 10, 2007
  5. jr
    Replies:
    3
    Views:
    409
Loading...

Share This Page