digital_soul
asked on
How can I retain linebreaks in a bound Literal control in Encode Mode?
Hi Experts
I am binding data from a database to a Literal Control with Mode set to Encode as the data is user generated, to ensure no script code can be rendered. Line breaks in the data are not being rendered and I need to be able to ensure they are.
Previously I would have done something like the following in a bound label Control
Text='<%# Eval("Text").ToString.Repl ace(vbCrLf ,"<br />") %>'
But this is giving me the error '''object.ToString()' is a 'method', which is not valid in the given context"
Presumbaly any attempt to replace with a <br /> tag will not work anyway when the Mode is set to Encode, so how can i do it?
Thanks
Stewart
I am binding data from a database to a Literal Control with Mode set to Encode as the data is user generated, to ensure no script code can be rendered. Line breaks in the data are not being rendered and I need to be able to ensure they are.
Previously I would have done something like the following in a bound label Control
Text='<%# Eval("Text").ToString.Repl
But this is giving me the error '''object.ToString()' is a 'method', which is not valid in the given context"
Presumbaly any attempt to replace with a <br /> tag will not work anyway when the Mode is set to Encode, so how can i do it?
Thanks
Stewart
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Please replace this part in dataset from where you are getting from.