![]() |
Need to manipulate (Container.DataItem("mydbfield")) inside <itemtemplate>
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> ??? Chum |
Re: Need to manipulate (Container.DataItem("mydbfield")) inside<itemtemplate>
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 mitchell@4guysfromrolla.com http://www.4GuysFromRolla.com http://www.ASPMessageboard.com http://www.ASPFAQs.com * When you think ASP, think 4GuysFromRolla.com! |
| All times are GMT. The time now is 11:02 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.