Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7129553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:15:17+00:00 2026-05-28T11:15:17+00:00

If I have the following (generic) ASP code: <asp:ObjectDataSource runat=server ID=myODS>…</asp:ObjectDataSource> <asp:GridView runat=server ID=myGV

  • 0

If I have the following (generic) ASP code:

<asp:ObjectDataSource runat="server" ID="myODS">...</asp:ObjectDataSource>

<asp:GridView runat="server" ID="myGV" DataSourceID="myODS">
   <Columns>

      <asp:TemplateField>
         <ContentTemplate>
            <asp:Label runat="server" ID="myLabel" Text='<%# [What goes here?] %>' />
         </ContentTemplate>
      </asp:TemplateField>

      <asp:BoundField ... />
      <%-- Other columns... --%>

   </Columns>
</asp:GridView>

What can I call within an ASP expression, inside my Template Field, that will allow me to have access to my ODS results? Basically, inside the expression, I want to do something like row("ID") to get a specific value out of a column from my ODS.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T11:15:18+00:00Added an answer on May 28, 2026 at 11:15 am

    There are a number of different syntaxes you can use to specify a particular property. The simplest is to use the Eval method:

        <asp:Label runat="server" ID="myLabel" Text='<%# Eval("ID") %>' />
    

    This is a short-hand syntax for the more verbose syntax using DataBinder.Eval static method, so you can use this more verbose syntax if you want:

        <asp:Label runat="server" ID="myLabel" Text='<%# DataBinder.Eval(Container.DataItem, "ID") %>' />
    

    See here for the MSDN documentation on DataBinder.Eval

    Edit:
    One thing I forgot to mention what that ASP.Net 2.0 and higher support the “Bind” method:

        <asp:Label runat="server" ID="myLabel" Text='<%# Bind("ID") %>' />
    

    which nominally supports 2-way data binding. Thus if you use the Bind method, you don’t have to manually screen-scrape your value from your inserted or deleted row, and the ASP.Net infrastructure will handle generating the new or modified object. However, in practice, there are a lot of caveats for using this. Your domain object must have a default constructor, must only be composed of simply properties, and I think there are a few more. In practice, this is so restrictive that I don’t think it is a very useful thing to use. But I just wanted to point it out.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code inside my asp.net-mvc project: private string GenerateEmail(RequestContext requestContext) {
I have the following generic .net code to change the background colour of a
I have the following method that is supposed to be a generic Save to
I have the following model structure: class Container(models.Model): pass class Generic(models.Model): name = models.CharacterField(unique=True)
I have some generic types, like the following: public struct Tuple<T1, T2> { ...
Is there any name for the following DB table design: Basically we have generic
I Have following code: Controller: public ActionResult Step1() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public
I have reproduced my problem in a console app. Following is the code. using
I have following code: #include <iostream> using namespace std; template<class T> T max(T *data,int
I have a GridView and want to on an ASP.NET Web Application page and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.