Web Hosting Talk







View Full Version : data binding question?


iitagsdotorg
07-25-2009, 10:17 PM
I have little problem with binding data to a form.

I have an object called GuestSpeaker which has a property 'Abstract'. I would like to present the information on a form using the FormView component.

The problem now is that de string Abstract can contain newline characters but in HTML they are not displayed. How can I replace all newline characters in the string Abstract to '<br />' tags. Same question for other characters that need to be replaced like é, ?, à...

Thanks,

Dark Light
07-26-2009, 07:13 AM
Which language/script are you using? Sounds like something.NET? If you can provide this information, it will be more likely that someone will be able to assist you.

If the language was PHP, you could use the nl2br() function to convert your newlines to a breakrule.

I don't know if .NET includes an nl2br alternative ( I doubt it though ) so you would need to do a string replacement on any newlines (\n) or returns (\r\n) to the <br /> string tags. Similarly, you would need to do string replacements on any other characters or entities that need converting in this regard.

I'm not entirely sure what you mean as the "other" characters don't have HTML equivalents (at least not with ?) but they do have URL encoding equivalents (? -> %3F).

iitagsdotorg
07-26-2009, 07:22 AM
:blush:thanks much....:agree::agree: