Solved

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

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now