Easier way to access a Datagrid Dataitem?

Discussion in 'ASP .Net' started by Raterus, Feb 13, 2004.

  1. Raterus

    Raterus Guest

    Hi,

    I'm using a datagrid, and the sub ItemDataBound to customize output of my
    datagrid when it is bound. Is the only way I can access the data in my
    datasource is to use

    DataBinder.Eval(e.Item.DataItem, "myFieldName")

    It just seems to be a little clunky to have to use this for every varible in
    my datasource, even more when using "option strict" you have to cast the
    result, making for an even longer statement. This isn't that much of a
    problem, i'm just wondering if i'm missing something that would be much
    easier.

    Thanks,
    --Michael
     
    Raterus, Feb 13, 2004
    #1
    1. Advertising

  2. Raterus

    Srinivas Guest

    After the datagrid is bound you can loop through and format the items

    e.g datagrid.items(0).cells(0).text

    Hope this helps

    Srinivas



    "Raterus" <raterus@localhost> wrote in message
    news:...
    > Hi,
    >
    > I'm using a datagrid, and the sub ItemDataBound to customize output of my
    > datagrid when it is bound. Is the only way I can access the data in my
    > datasource is to use
    >
    > DataBinder.Eval(e.Item.DataItem, "myFieldName")
    >
    > It just seems to be a little clunky to have to use this for every varible

    in
    > my datasource, even more when using "option strict" you have to cast the
    > result, making for an even longer statement. This isn't that much of a
    > problem, i'm just wondering if i'm missing something that would be much
    > easier.
    >
    > Thanks,
    > --Michael
    >
    >
     
    Srinivas, Feb 13, 2004
    #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. Norman Ackroyd
    Replies:
    1
    Views:
    543
  2. Kathy Burke
    Replies:
    0
    Views:
    339
    Kathy Burke
    Jul 31, 2003
  3. PiotrO
    Replies:
    0
    Views:
    302
    PiotrO
    May 2, 2004
  4. Earl Teigrob
    Replies:
    0
    Views:
    447
    Earl Teigrob
    Jul 7, 2004
  5. Skowronek
    Replies:
    4
    Views:
    4,536
    ProgTalk
    Dec 4, 2007
Loading...

Share This Page