General DataBinder Question

Discussion in 'ASP .Net Datagrid Control' started by Tom Carter, Feb 4, 2004.

  1. Tom Carter

    Tom Carter Guest

    I hope some datagrid expert can help me with this -- I have a datagrid
    which I use to display, sort and filter data from a variety of data
    tables based on a drop down list selection.

    I have added a template column to this environment and what I
    would like to know concerns specifically the OnDataBinding event for
    the ItemTemplateColumn.

    To that ItemTemplate Column I have added a label and I would like
    to use the record id for each row shown to build the text to display
    in this label. Essentially, what my question boils down to is -- Can
    one use a c# function call in this manner; in order to set properties
    of the label??

    I have seen many examples where data stored in the database is
    assigned using the 'DataBinder.Eval (Container.Item,"field_name");'
    but I have not yet seen where a c# function is called that returns the
    property.

    If it can be done, I would appreciate any examples.

    Tom
     
    Tom Carter, Feb 4, 2004
    #1
    1. Advertising

  2. Tom Carter

    Earl Teigrob Guest

    Tom, don't know if Im an expert but here is how I set properties in the
    datagrid using an external function (method) call (in this case to a static
    member of a class that returns a bool type, but I call code behind methods
    all the time).

    <tr id="Description_Row" runat="server" visible='<%#
    !csCommonLibrary.Common.IsStringEmpty(DataBinder.Eval(Container.DataItem,"De
    scription")) %>'>

    Is this what you are looking for?






    "Tom Carter" <> wrote in message
    news:...
    > I hope some datagrid expert can help me with this -- I have a datagrid
    > which I use to display, sort and filter data from a variety of data
    > tables based on a drop down list selection.
    >
    > I have added a template column to this environment and what I
    > would like to know concerns specifically the OnDataBinding event for
    > the ItemTemplateColumn.
    >
    > To that ItemTemplate Column I have added a label and I would like
    > to use the record id for each row shown to build the text to display
    > in this label. Essentially, what my question boils down to is -- Can
    > one use a c# function call in this manner; in order to set properties
    > of the label??
    >
    > I have seen many examples where data stored in the database is
    > assigned using the 'DataBinder.Eval (Container.Item,"field_name");'
    > but I have not yet seen where a c# function is called that returns the
    > property.
    >
    > If it can be done, I would appreciate any examples.
    >
    > Tom
     
    Earl Teigrob, Feb 4, 2004
    #2
    1. Advertising

  3. Tom Carter

    Tom Carter Guest

    Hi Earl,

    Thanks, this was a big help.

    Tom
    "Earl Teigrob" <> wrote in message news:<#>...
    > Tom, don't know if Im an expert but here is how I set properties in the
    > datagrid using an external function (method) call (in this case to a static
    > member of a class that returns a bool type, but I call code behind methods
    > all the time).
    >
    > <tr id="Description_Row" runat="server" visible='<%#
    > !csCommonLibrary.Common.IsStringEmpty(DataBinder.Eval(Container.DataItem,"De
    > scription")) %>'>
    >
    > Is this what you are looking for?
    >
    >
    >
    >
    >
    >
    > "Tom Carter" <> wrote in message
    > news:...
    > > I hope some datagrid expert can help me with this -- I have a datagrid
    > > which I use to display, sort and filter data from a variety of data
    > > tables based on a drop down list selection.
    > >
    > > I have added a template column to this environment and what I
    > > would like to know concerns specifically the OnDataBinding event for
    > > the ItemTemplateColumn.
    > >
    > > To that ItemTemplate Column I have added a label and I would like
    > > to use the record id for each row shown to build the text to display
    > > in this label. Essentially, what my question boils down to is -- Can
    > > one use a c# function call in this manner; in order to set properties
    > > of the label??
    > >
    > > I have seen many examples where data stored in the database is
    > > assigned using the 'DataBinder.Eval (Container.Item,"field_name");'
    > > but I have not yet seen where a c# function is called that returns the
    > > property.
    > >
    > > If it can be done, I would appreciate any examples.
    > >
    > > Tom
     
    Tom Carter, Feb 13, 2004
    #3
    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. dm_dal

    DataBinder.Eval question

    dm_dal, Feb 16, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    438
    dm_dal
    Feb 16, 2004
  2. Chris

    DataBinder.Eval question

    Chris, Apr 21, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,400
    =?Utf-8?B?QmluIFNvbmcsIE1DUA==?=
    Apr 21, 2004
  3. Chris
    Replies:
    1
    Views:
    959
    =?Utf-8?B?QmluIFNvbmcsIE1DUA==?=
    May 28, 2004
  4. George Durzi

    Repeater/DataBinder Question

    George Durzi, Nov 9, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    493
    George Durzi
    Nov 9, 2004
  5. =?Utf-8?B?UGllcnJlIFNoaXJ2YW4=?=

    Question about DataBinder.Eval method

    =?Utf-8?B?UGllcnJlIFNoaXJ2YW4=?=, Jan 28, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    4,084
    =?Utf-8?B?UGllcnJlIFNoaXJ2YW4=?=
    Jan 31, 2005
Loading...

Share This Page