I have a textbox(along with many other textboxes) in my cshtml view, where the user can enter some random texts(which can me multiline in nature) and save it in database. Once the data is saved successfully, the user can view the saved data using a "View Stats" button. On click of this button, all the saved data will be loaded in read-only mode in respective labels. The problem here is, the multiline texts that the user entered, is displayed in single line in the label. But when the user tries to edit the record(where the data is disaplyed in a textbox) the data is shown as multiline. How can I achieve the same functionality in view mode where I wish to display the multiline texts in label.
Below is my textbox:
@using (Html.BeginInnerPanel(true, new { style = "width:100%;", id = "pnlRemarks" }, "", false))
{
using (Html.BeginInnerPanelBody())
{
using (Html.BeginFieldWrap("Remarks", "", new { style = "width:100%" }))
{
@Html.TextArea("txtRemarks", "", new { style = "width:99%;height:80px; text-transform: uppercase;" });
}
}
}
Below is my Label:
@using (Html.BeginInnerPanel(true, new { style = "width:100%; display:none;", id = "pnlRemarksV" }, "", false))
{
using (Html.BeginInnerPanelBody())
{
using (Html.BeginFieldWrap("Remarks", "", new { style = "width:100%" }))
{
<label id="lblViewRemarks" style = "font-weight:bold"></label>
}
}
}
I hide and show the panels based on edit or view mode. Could you please help me display text in label as multiline.