Solved

HyperLink with 2 parameters and Server.UrlEncode - can't get it all to work!

Posted on 2010-09-17
2
733 Views
Last Modified: 2013-11-05
Hi I am struggling with the following piece of code:

<asp:HyperLink ID="HyperLink1" Text='<%#DataBinder.Eval(Container.DataItem,"CompanyName")%>' runat="server" NavigateUrl='<%# "displayCompany.aspx?ID=" + DataBinder.Eval(Container.DataItem, "CompanyID") + "&CN=" + Server.UrlEncode(Container.DataItem("CompanyName"))%>' />

It worked fine before I tried to add Server.UrlEncode as CompanyName will often have spaces.  The error is:

CS1955: Non-invocable member 'System.Web.UI.IDataItemContainer.DataItem' cannot be used like a method.

Please help me!
0
Comment
Question by:Lorna70
2 Comments
 
LVL 41

Accepted Solution

by:
guru_sami earned 500 total points
ID: 33703645
Try this:
NavigateUrl='<%# "displayCompany.aspx?ID=" + Eval("CompanyID") + "&CN=" + Server.UrlEncode(Eval("CompanyName").ToString())%>'

Make sure you are convert it ToString
0
 

Author Comment

by:Lorna70
ID: 33708272
Thanks Guru Sami - I knew it had to be something simple lol!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

685 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