Chumley the Walrus wrote:
> Inside a datalist, or repeater control <itemtemplate>, i'm trying to
> do an If statement with objects from my recordset :
>
>
> <% if (Container.DataItem("mydbfield")) <> "" then
> response.write(Container.DataItem("mydbfield2"))
> end if %>
>
> ..but i get a Container not declared error. It seems i can't
> manipulate these "containers" inside <itemtemplates>
Call a "helper function" using the databinding syntax:
<ItemTemplate>
<%# SomeFunctionDefinedInCodeBehindClass(Container.Dat aItem("field")) %>
</ItemTemplate>
Then, in your code-behind class:
Public Function SomeFunctionDefinedInCodeBehindClass(value as String) as
String
If value <> "" then
Return value
End If
End Function
For an example of using a helper function in a template see:
http://datawebcontrols.com/faqs/Cust...umnValue.shtml
Happy Programming!
--
Scott Mitchell
http://www.4GuysFromRolla.com
http://www.ASPMessageboard.com
http://www.ASPFAQs.com
* When you think ASP, think 4GuysFromRolla.com!