Print Page | Close Window

Needs Help with Container.DataItem

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: ASP.NET Discussion
Forum Description: Discussion and chat on ASP.NET related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=12447
Printed Date: 28 March 2026 at 11:07pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Needs Help with Container.DataItem
Posted By: Misty
Subject: Needs Help with Container.DataItem
Date Posted: 04 November 2004 at 8:05pm

I cannot figure out where I am supposed to put a ) for

 

<%# IIF(FieldValueIsMissing(Container.DataItem("WebSite")), "", "<a href='" & (Container.DataItem("WebSite") & "'>Go To Web Site</a>", "")%>.

 

I got the following error message: BC30198: ')' expected.

I tried adding a ) to several places. It would not work. Can you please help me figure out where the ) should be?




Replies:
Posted By: Phat
Date Posted: 04 November 2004 at 9:39pm
Originally posted by Misty Misty wrote:


 

<%# IIF(FieldValueIsMissing(Container.DataItem("WebSite")), "", "<a href='" & (Container.DataItem("WebSite")) & "'>Go To Web Site</a>", "")%>.

 



I think


Posted By: Misty
Date Posted: 04 November 2004 at 9:43pm

That didn't work. I had tried that before. I got the following error message:  BC30057: Too many arguments to 'Public Function IIf(Expression As Boolean, TruePart As Object, FalsePart As Object) As Object'.

It's obviously a problem with the syntax somewhere. I tried putting another ) at the end, but it didn't work. I got the error message about needing ).

Here's the function that I am using: Function FieldValueIsMissing(objValueToCheck As Object) As Boolean

        if objValueToCheck is DBNull.Value Then
                 return True
        else
                 return False
        end if
End Function

 



Posted By: Leeb65
Date Posted: 05 November 2004 at 2:22am

<%# IIF(FieldValueIsMissing(Container.DataItem("WebSite")), "", "<a href='" & Container.DataItem("WebSite") & "'>Go To Web Site</a>")%>

That should work.



-------------
Lee

http://www.rheinsitemedia.de">


Posted By: Phat
Date Posted: 05 November 2004 at 2:24am
it may not be a ) becasue of the ' and " in there it make it a bit hard. Try stripping it back to

<%# IIF(FieldValueIsMissing(Container.DataItem("WebSite")), "One", "Two", "")%>.

You may have too many , in there.
it should be
IIf(expression, truepart, falsepart)

I thnink you have
IIf(expression, truepart, falsepart,extra part)

try

<%# IIF(FieldValueIsMissing(Container.DataItem("WebSite")), "One", "Two")%>.

or

<%# IIF(FieldValueIsMissing(Container.DataItem("WebSite")), "", "<a href='" & (Container.DataItem("WebSite")) & "'>Go To Web Site</a>")%>.



Posted By: Mart
Date Posted: 05 November 2004 at 2:52am

This code definatley works, tweak it to  yours:

<%# IIf(Databinder.Eval(Container.DataItem, "Popularity") > (New Devjunkies_Link_Manager.SettingsProvider).HotLimit, " <span class='hot'>Hot!</span>", String.Empty) %>



Posted By: Misty
Date Posted: 05 November 2004 at 1:26pm

I forgot to mention that I cannot use Databinder.Eval for this particular DataList. The line of code: <%# IIF(FieldValueIsMissing(Container.DataItem("WebSite")), "", "<a href='" & Container.DataItem("WebSite") & "'>Go To Web Site</a>")%>

that Leeb65 gave worked.

 




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net