DataBinder.Eval

A

A Ratcliffe

Although at the moment, I have a couple of large classic ASP projects on the
go, when I need to take a break, I'm experimenting with ASP.NET (with both
VB.NET and C#).

I notice that most wizard-generated code uses DataBinder.Eval for
datafields, which is fine for most database fields, however I also have
image filenames in a couple of fields in one of my test tables.

Looking at the DataBinder documentation, I see that Eval is overloaded, and
I was wondering if it would be possible to add an additional overload for
Images, which would either evaluate the image's filename to an <IMG> tag, or
place a transparent spacer gif, &nbsp, or alternate image if the filename is
NULL or "".

I know I could just write a separate function to do this, but it would be
good to have everything being sensibly (My)DataBinder.Evaluated (maybe I
ought to suggest this as an addition in ASP.NET Framework 1.2).

Looking at one of the overloads of Eval, I assume I could use the Format
specifier to convert the filename into an <IMG> tag, but that wouldn't cover
the possibilities of a NULL or "".

Does anyone have any light to shine on this?

Yours,

Ann-Marie Ratcliffe
(e-mail address removed)
 
M

MSFT

The DataBinder class is NotInheritable, therefore you can't use it as a
base class, in other words, overides the eval method. You may create your
own method like:

public function EvalImage(StrImage as String) as String

if len(StrImage) = 0 then

...
else

...
end If


End Function

and use this function out Databinder.Eval()

Luke

"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026?? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
http://www.microsoft.com/security/security_bulletins/ms03-026.asp and/or to
visit Windows Update at http://windowsupdate.microsoft.com to install the
patch. Running the SCAN program from the Windows Update site will help to
insure you are current with all security patches, not just MS03-026."
 

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,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top