Solved

string.concat doubts

Posted on 2008-10-01
2
546 Views
Last Modified: 2012-05-05
In the following code i need join another parameter in the details.aspx like:

details.aspx?id=xxx&ref=zzz

How can i do, with string.concat or another way (join 3 stings).

<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/images/info.jpg" 

onclick="ImageButton1_Click" PostBackUrl='<%# string.concat("~/details.aspx?id=", DataBinder.Eval(Container.DataItem, "id").tostring()) %>' />

Open in new window

0
Comment
Question by:rflorencio
2 Comments
 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 250 total points
Comment Utility
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/images/info.jpg"
onclick="ImageButton1_Click" PostBackUrl='<%# "~/details.aspx?id=" &  DataBinder.Eval(Container.DataItem, "id").tostring() &"&ref=" & DataBinder.Eval(Container.DataItem, "ref").tostring() %>' />
0
 
LVL 43

Assisted Solution

by:TimCottee
TimCottee earned 250 total points
Comment Utility
Hello rflorencio,

String.Concat is better than & as it is more efficient though with small strings this performance gain may not be noticeable. Another alternative is string.format:

 

Which effectively places the arguments (as many as you want) into the string in the appropriate places.


Regards,

TimCottee
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

743 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