Accesing datasource fields from inline code in a GridView.

Discussion in 'ASP .Net Web Controls' started by pradeep, May 25, 2006.

  1. pradeep

    pradeep Guest

    In the code below, how to access the 'FirstName' field value of the
    datasource from with in the code segment (enclosed in <% %>)?

    ----------------------------------------
    <asp:GridView ID="GridView1" DataSourceID="SqlDataSource1" runat="server">
    <Columns>

    <asp:BoundField DataField="FirstName" HeaderText="FirstName"/>

    <asp:TemplateField>
    <ItemTemplate>
    <%

    string firstName = /** do something here to access the 'firstName'
    field value>; **/
    %>
    </ItemTemplate>

    </asp:TemplateField>

    </Columns>

    </asp:GridView>
    pradeep, May 25, 2006
    #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. Abhi
    Replies:
    2
    Views:
    734
    E. Robert Tisdale
    Jul 3, 2003
  2. Alvin
    Replies:
    7
    Views:
    473
    E. Robert Tisdale
    May 6, 2005
  3. Replies:
    3
    Views:
    456
  4. R.A.M.

    accesing controls in code-behind

    R.A.M., Dec 20, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    303
    R.A.M.
    Dec 20, 2006
  5. jobs
    Replies:
    2
    Views:
    1,585
Loading...

Share This Page