Connecting Tech Pros Worldwide Forums | Help | Site Map

DataList Container

Chris Fink
Guest
 
Posts: n/a
#1: Nov 17 '05
Hi,

My question is how do I set some text within my datalist itemtemplate to be
bold, based on the higher value of two bound data items? For example, if the
value of <%# Trim(Container.DataItem("points1") %> is greater than the
value of <%# Trim(Container.DataItem("points2") %> then I want to make the
value bold contained in <%# Trim(Container.DataItem("points1") %>. Any help
is appreciated.

Is it possible to compare the dataitem's with an IF statement within the
datalist?

Thanks



Karl Seguin
Guest
 
Posts: n/a
#2: Nov 17 '05

re: DataList Container


You can call a protected/public function and pass in the two parameters...

<%# IsGreater(Trim(Container.DataItem("points1"),
Trim(Container.DataItem("points2")) %>

protected function IsGreater(ByVal pt1 as string, byVal pt2 as string) as
string
'convert to ints, or pass them in as ints here
if pt1 > pt2 then
return "<b>" & pt1 & "</b>"
end if
return pt1
end function

"Chris Fink" <chris@chrisfink.com> wrote in message
news:uJBZOsLQDHA.3664@tk2msftngp13.phx.gbl...[color=blue]
> Hi,
>
> My question is how do I set some text within my datalist itemtemplate to[/color]
be[color=blue]
> bold, based on the higher value of two bound data items? For example, if[/color]
the[color=blue]
> value of <%# Trim(Container.DataItem("points1") %> is greater than the
> value of <%# Trim(Container.DataItem("points2") %> then I want to make[/color]
the[color=blue]
> value bold contained in <%# Trim(Container.DataItem("points1") %>. Any[/color]
help[color=blue]
> is appreciated.
>
> Is it possible to compare the dataitem's with an IF statement within the
> datalist?
>
> Thanks
>
>[/color]


Closed Thread