473,387 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

replace more than one specific character in one statement!

hi every body!
i want to do this, but vs.net dont let me to do it!!! :-(

<td width="81%" height="115" rowspan="3" id="txtcell" runat="server">

<%# (DataBinder.Eval(Container.DataItem,"logtext").ToS tring().Replace("
","&nbsp;")

DataBinder.Eval(Container.DataItem,"logtext").ToSt ring().Replace("\n","<BR>"))
%>
</td>

i don,t want to changing my data in db.

thanks.

Jul 2 '06 #1
3 2764
You are evaluating two things, with no expression in between to say what
you should do with the two strings.

Why not do this?

<%# HttpUtility.HtmlEncode((string) DataBinder.Eval(Container.DataItem,
"logtext")).Replace("\n", "<BR>") %>

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<fa*****@yahoo.comwrote in message
news:11**********************@v61g2000cwv.googlegr oups.com...
hi every body!
i want to do this, but vs.net dont let me to do it!!! :-(

<td width="81%" height="115" rowspan="3" id="txtcell" runat="server">

<%# (DataBinder.Eval(Container.DataItem,"logtext").ToS tring().Replace("
","&nbsp;")

DataBinder.Eval(Container.DataItem,"logtext").ToSt ring().Replace("\n","<BR>"))
%>
</td>

i don,t want to changing my data in db.

thanks.

Jul 2 '06 #2
You have misunderstood how the Replace method actually works. It's used
on a string value to create a new string value with the replacements.

As the Replace method returns a string, you can use that string in the
next Replace method:

<%# DataBinder.Eval(Container.DataItem,"logtext").ToSt ring().Replace("
","&nbsp;").Replace("\n","<BR>") %>

fa*****@yahoo.com wrote:
hi every body!
i want to do this, but vs.net dont let me to do it!!! :-(

<td width="81%" height="115" rowspan="3" id="txtcell" runat="server">

<%# (DataBinder.Eval(Container.DataItem,"logtext").ToS tring().Replace("
","&nbsp;")

DataBinder.Eval(Container.DataItem,"logtext").ToSt ring().Replace("\n","<BR>"))
%>
</td>

i don,t want to changing my data in db.

thanks.
Jul 2 '06 #3

Göran Andersson wrote:
You have misunderstood how the Replace method actually works. It's used
on a string value to create a new string value with the replacements.

As the Replace method returns a string, you can use that string in the
next Replace method:

<%# DataBinder.Eval(Container.DataItem,"logtext").ToSt ring().Replace("
","&nbsp;").Replace("\n","<BR>") %>

fa*****@yahoo.com wrote:
hi every body!
i want to do this, but vs.net dont let me to do it!!! :-(

<td width="81%" height="115" rowspan="3" id="txtcell" runat="server">

<%# (DataBinder.Eval(Container.DataItem,"logtext").ToS tring().Replace("
","&nbsp;")

DataBinder.Eval(Container.DataItem,"logtext").ToSt ring().Replace("\n","<BR>"))
%>
</td>

i don,t want to changing my data in db.

thanks.


thanx a lot "Göran", my problem solved!

best regards!!!

Jul 3 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: pembed2003 | last post by:
Hi all, I need to write a function to search and replace part of a char* passed in to the function. I came up with the following: char* search_and_replace(char* source,char search,char*...
19
by: Paul | last post by:
hi, there, for example, char *mystr="##this is##a examp#le"; I want to replace all the "##" in mystr with "****". How can I do this? I checked all the string functions in C, but did not...
14
by: Etu | last post by:
Hi, I have a string: string c = "'abc' \"cde\", 'mno' \"xyz\","; how can I use the c.Replace(???, ???) method to have this string: "'abc' "cde", 'mno' "xyz"," that is, all the...
6
by: Chris Anderson | last post by:
Anyone know of a fix (ideally) or an easy workaround to the problem of escape characters not working in regex replacement text? They just come out as literal text For example, you'd think that thi...
4
by: jgabbai | last post by:
Hi, What is the best way to white list a set of allowable characters using regex or replace? I understand it is safer to whitelist than to blacklist, but am not sure how to go about it. Many...
3
by: channu | last post by:
Hi I am beginner in c++ coding.I want to read a text file and replace commas and space with tabs. Can any buddy help me out. Thanks Channu
52
by: MP | last post by:
Hi trying to begin to learn database using vb6, ado/adox, mdb format, sql (not using access...just mdb format via ado) i need to group the values of multiple fields - get their possible...
8
by: Warren Moxley | last post by:
Hi there, i've been searching for a C String search and replace function. I need to find all occurrences of " " in a char* array, and replace them with another char, I know how to do this in...
10
by: Lonifasiko | last post by:
Hi, Just want to replace character at index 1 of a string with another character. Just want to replace character at that position. I thought Replace method would be overloaded with an index...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.