DataList Container

  • Thread starter Thread starter Chris Fink
  • Start date Start date
C

Chris Fink

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
 
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
 
Back
Top