Using iif with navigateurl but passing two parameters

Posted on 2009-04-28
Medium Priority
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

GiftsonDJohn earned 1000 total points
ID: 24270497
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

ID: 31575339
Thanks for that, it has helped no end.


Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

839 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