0

I have an asp webform site and on one page i have a asp:TextBox with TextMode="MultiLine" the field code is shown below

<asp:TextBox ID="Step04OtherField" runat="server" class="form-control" style="max-width: 100%" TextMode="MultiLine" Rows="5"></asp:TextBox>

this page stores all details on the page in a session and then displays the enteries on the next page. The thing is even though the user may have entered 2 enteries in the textbox and each time clicked the enter key, it displays on one line on the confirmation page so isn't really that clear.

Is there a way to do this so that when the session value is displayed on the confirmation page, each enter key press also displays on a new line on this page

Session store code behind

Session["Step04OtherField"] = Step04OtherField.Text;

Confirmation page HTML

<div class="form-group">
    <asp:Label ID="Step04BrowsersLabel" class="col-xs-6 col-sm-3 control-label" runat="server" Text="Browser(s) to check on:"></asp:Label>
    <div class="col-xs-6 col-sm-9 form-control-static">
         <%=Session["Step04OtherField"] %>
    </div>
</div>

When when the page is displayed it displays as: Browser(s) to check on: Entry1 Entry2 etc

What i would like is for it to be displayed as something like

Browser(s) to check on: Entry1
                                           Entry2
                                           etc

Rahul Singh
  • 21,585
  • 6
  • 41
  • 56
murday1983
  • 3,806
  • 14
  • 54
  • 105

1 Answers1

1

This will work for the text part:

    Session["Step04OtherField"] = Step04OtherField.Text.Replace("\r\n", "<br />");

Then for the html formatting:

    <table>
            <row>
                <td valign="top">Browser(s) to check on:</td>
                <td> <%=(string)Session["Step04OtherField"] %></td>
            </row>
        </table>      
Gregg
  • 615
  • 6
  • 6