Link to home
Start Free TrialLog in
Avatar of Lorna70
Lorna70

asked on

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

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!
ASKER CERTIFIED SOLUTION
Avatar of guru_sami
guru_sami
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Lorna70
Lorna70

ASKER

Thanks Guru Sami - I knew it had to be something simple lol!