Solved

string.concat doubts

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
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…

809 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