Logo 
Search:

Asp.net Answers

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds
  Question Asked By: Trupti Patil   on Feb 06 In Asp.net Category.

  
Question Answered By: Guadalupe Rogers   on Feb 06

I had that problem, I figured you can do this ::

Firstly the problem  arises because when you have called
if ((bool) DataBinder.Eval(Container.DataItem, "bBooleanField"))
and it doesn't know what Container is because the line  is not databound ...
which is signified by the #.

My fix for it was this
You can call a function inputting the databound value
<%# MySupp((string)DataBinder.Eval(Container.DataItem, "suppname"))%>

then from that function (in code behind) you can return the html you need to
make your page work, mine was


public string MySupp(string strg)
{
if (supp != strg)
{
supp = strg;
str = "<tr><td valign=middle colspan=4><font class=supplier>";
str += strg;
str +=" </font></td></tr>";
return str;
}
else
{
supp = strg;
return "";
}
}

It's sneaky isn't it ... and cool ... and took ages to figure out (by me I might
add ... so use it at your peril)
There may be better ways to do it ... but when you're dealing with templates  in
html based files, I can't think of one.

Share: 

 

This Question has 6 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on problem with conditional output in templates Or get search suggestion and latest updates.


Tagged: