Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

string.concat doubts

Posted on 2008-10-01
2
Medium Priority
?
556 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 1000 total points
ID: 22613144
<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 1000 total points
ID: 22613197
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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

926 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