I having logic in SQL Server stored procedure where i am using next line char,
CASE
WHEN DATEPART(hh, InseptionDate) > 12
THEN CAST(YEAR(InseptionDate) AS VARCHAR) + N'年' + CAST(MONTH(InseptionDate) AS VARCHAR) + N'月' +
CAST(DAY(InseptionDate) AS VARCHAR) + N'日' + N'午後' + CAST(DATEPART(hh, InseptionDate) - 12 AS VARCHAR) + N'時' + N'から'
+CHAR(13)+
CAST(YEAR(ExpiryDate) AS VARCHAR) + N'年' + CAST(MONTH(ExpiryDate) AS VARCHAR) + N'月' +
CAST(DAY(ExpiryDate) AS VARCHAR) + N'日' + N'午後4時まで' + CAST(PolicyTerm AS VARCHAR) + N'年間'
ELSE CAST(YEAR(InseptionDate) AS VARCHAR) + N'年' + CAST(MONTH(InseptionDate) AS VARCHAR) + N'月' +
CAST(DAY(InseptionDate) AS VARCHAR) + N'日' + N'午前' + CAST(DATEPART(hh, InseptionDate) AS VARCHAR) + N'時' + N'から' +
+'<br/>' +
CAST(YEAR(ExpiryDate) AS VARCHAR) + N'年' + CAST(MONTH(ExpiryDate) AS VARCHAR) + N'月' +
CAST(DAY(ExpiryDate) AS VARCHAR) + N'日' + N'午後4時まで' + CAST(PolicyTerm AS VARCHAR) + N'年間'
END AS PolicyPeriod,
The returned policyperiod value is assigned to property like below, PolicyPeriod = Helpers.Get(obj, "PolicyPeriod"),
In view page this policyperiod is assinged to like below,when i mouse over the policy period in visual studio in running mode, it shows the value as below with break tag,
2014年7月31日午前0時から<br/>2016年7月31日午後4時まで2年間
why this break tag is not recognized by browser... Should i have to change anything in @Html.Label property
@Html.Label(Model.PolicyPeriod, new { id = "", name = "" })
Below is the extension method for the label
[SuppressMessage("Microsoft.Usage", "ReviewUnusedParameters", MessageId = "helper", Justification = "Required for Extension Method")]
public static MvcHtmlString Label(this HtmlHelper helper, string value, object htmlAttributes)
{
TagBuilder labelBuilder = new TagBuilder("label");
Dictionary<string, object> attributes = htmlAttributes as Dictionary<string, object>;
if (attributes != null)
{
labelBuilder.MergeAttributes(attributes);
}
labelBuilder.SetInnerText(value);
return new MvcHtmlString(labelBuilder.ToString(TagRenderMode.Normal));
}
Here the CHAR(13) or break tag which i have appended in sql is not working.
Actual result: 2014年7月31日午前0時から<br/>2016年7月31日午後4時まで2年間
Expected result:2014年7月31日午前0時から
2016年7月31日午後4時まで2年間
Both char(13) and <br/>
tag not working..