bind two eval with navigateurl property of hyperlink using asp net

I have one hyperlink control in my page. I have binded it's navigate property dynamically using Eval like below :
<asp:HyperLink ID="HyperLink1" runat="server"  NavigateUrl=
'<%# DataBinder.Eval(Container.DataItem, "imageurl") %>'>Button</asp:HyperLink>

But my problem is that i want to bind two different Eval with the navigate url property. I almost tried everything but all in vain. May be you guyz can help me.. Any help would be appreciated.
Posted by Harpreet 7/1/2014 10:50:01 PM
Total Answers : 1
Answer 1
Try like below. It will solve your problem.

<asp:HyperLink ID="HyperLink2" runat="server" 

NavigateUrl='<%# string.Format

("~/yourpage.aspx?Id={0}&Name={1}&Country={2}",
HttpUtility.UrlEncode(Eval("Id").ToString

()), HttpUtility.UrlEncode(Eval("Name").ToString()),

HttpUtility.UrlEncode(Eval("Country").ToString())) %>'>Buy

Now</asp:HyperLink>

Hope you will understand the code.
Enjoy and keep in touch with StepCoder.
Posted by StepCoder Team 7/1/2014 10:57:15 PM
Post your answer
Preview
Sign in to your account
Your Email : 
Password :   
Forgot your password
Don't have StepCoder account ?
Create a new account
 
Follow me on twitter
About Me
Harpreet Singh
I began programming with C++ when i was 17. Then at the middle of my study .NET came. Then I began to read C# and VB.NET. By the time i learnt SQL and ASP.NET, and developed some websites such as news portals that are active now. Currently i am running my own Software company.
Answer these questions! If you know the answer.