Solved

string.concat doubts

Posted on 2008-10-01
2
550 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
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 250 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
location of a form 2 25
TimeZone, day light savings, Sql server, asp.net 6 38
What are the simplest ways to create a Merge Sort? 3 29
Name Space error VS2015 1 27
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…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

821 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