Using iif with navigateurl but passing two parameters

Posted on 2009-04-28
Last Modified: 2013-11-26
Hi I am using an IIF statement with NavigateURL I can do this when passing one parameter but i need to pass another parameter. How do i do this. I have included what i have so far.
I am using visual studio 2008 and VB
<asp:HyperLink ID="HyperLink1" runat="server" 

 NavigateUrl='<%# iif(eval("Type") = "Region", Eval("ContactID", "Contact.aspx?ID={0}&parentnum={1}"), iif(eval("Type") = "Agency", Eval("ContactID", "Contact.aspx?ID={0}"), Eval("ContactID", "Contact.aspx?ID={0}"))) %>'  Text='<%# Eval("Type") %>'></asp:HyperLink>

Open in new window

Question by:Mick_Buckley
    LVL 14

    Accepted Solution

    Use like this.

    <asp:HyperLink ID="HyperLink1" runat="server"
     NavigateUrl='<%# iif(eval("Type") = "Region", string.Format("Contact.aspx?ID={0}&parentnum={1}", Eval("ContactID"), Eval("ParentNum")), iif(eval("Type") = "Agency", Eval("ContactID", "Contact.aspx?ID={0}"), Eval("ContactID", "Contact.aspx?ID={0}"))) %>'  Text='<%# Eval("Type") %>'></asp:HyperLink>

    Author Closing Comment

    Thanks for that, it has helped no end.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    In my previous article ( we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
    Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now