General DataBinder Question

T

Tom Carter

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
 
E

Earl Teigrob

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?
 
T

Tom Carter

Hi Earl,

Thanks, this was a big help.

Tom
Earl Teigrob said:
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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top