Solved

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

Posted on 2010-09-17
2
728 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

776 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