Hi,
In my .aspx page I have some code to display some data from a SQL query:
I figured this looked a little untidy so I decided to try and make a little function in my .cs file to do the formatting.
Please can you let me know how I call this function from my .aspx page - once I understand how to do that I am then going to make the function do a few other things to format the text just the way I want it.
Thanks very much
Ed
In my .aspx page I have some code to display some data from a SQL query:
Code:
<asp:Label ID="EventDetailsLabel" runat="server"
Text='<%# Eval("EventDetails").ToString().Replace(Environment.NewLine,"<br />") %>' CssClass="upcomingevents_details" />
I figured this looked a little untidy so I decided to try and make a little function in my .cs file to do the formatting.
Code:
public string addLineBreaks(string eventDescription)
{
string formattedEventDescription = eventDescription.Replace(Environment.NewLine, "<br />");
return formattedEventDescription;
}
Please can you let me know how I call this function from my .aspx page - once I understand how to do that I am then going to make the function do a few other things to format the text just the way I want it.
Thanks very much
Ed