Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Needs Help with Container.DataItem
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Needs Help with Container.DataItem

 Post Reply Post Reply
Author
Misty View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 February 2002
Location: United States
Status: Offline
Points: 711
Post Options Post Options   Thanks (0) Thanks(0)   Quote Misty Quote  Post ReplyReply Direct Link To This Post Topic: Needs Help with Container.DataItem
    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?



Edited by Misty
Back to Top
Phat View Drop Down
Senior Member
Senior Member


Joined: 23 February 2003
Status: Offline
Points: 386
Post Options Post Options   Thanks (0) Thanks(0)   Quote Phat Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Misty View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 February 2002
Location: United States
Status: Offline
Points: 711
Post Options Post Options   Thanks (0) Thanks(0)   Quote Misty Quote  Post ReplyReply Direct Link To This Post 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

 



Edited by Misty
Back to Top
Leeb65 View Drop Down
Groupie
Groupie


Joined: 05 December 2003
Location: Germany
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote Leeb65 Quote  Post ReplyReply Direct Link To This Post 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


Back to Top
Phat View Drop Down
Senior Member
Senior Member


Joined: 23 February 2003
Status: Offline
Points: 386
Post Options Post Options   Thanks (0) Thanks(0)   Quote Phat Quote  Post ReplyReply Direct Link To This Post 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>")%>.

Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post 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) %>

Back to Top
Misty View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 February 2002
Location: United States
Status: Offline
Points: 711
Post Options Post Options   Thanks (0) Thanks(0)   Quote Misty Quote  Post ReplyReply Direct Link To This Post 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.

 

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.