Using iif with navigateurl but passing two parameters

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

Who is Participating?
GiftsonDJohnConnect With a Mentor Commented:
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>
Mick_BuckleyAuthor Commented:
Thanks for that, it has helped no end.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.