html循环输出文本框元素,多行文本框返回页面时显示HTML元素

I have an asp.net web form which on one page has a multi line textbox. When the user types in this field and continues the details are displayed on a confirmation page and displays as the user entered

Example

This is the first line

This is the second line

But when I click my edit button (which directs me back to my page) my textbox displays as

This is the first line
This is the second line

I want it to keep its styling but don't know how to do this. The details are stored in the session.

Code behind

protected void Step07SubmitButton_Click(object sender, EventArgs e)

{

Session["Step07OtherDetailsField"] = Step07OtherDetailsField.Text.Replace("\r\n", "
");

Response.Redirect("/Quotation/pg3.aspx");

}

I tried the following in my Page_Load

Step07OtherDetailsField.Text.Replace("
", "\r\n");

and also

Step07OtherDetailsField.Text.Replace("
", Environment.NewLine);

But for some reason when I debug it, it says that my .text is empty but the previous wording is actually still displayed in the field and the
is also still displayed.

Solutions1

You don't need to replace anything. You just store value in session and display it to any textbox, it will maintain \r and \t.

If you want to display result in span then display result to textbox with multiline then apply css for no border,etc.

Talk1:

I need to replace so that on my confirmation page it displays as the user entered it and is readable to them but as I said when I click my edit button (so the user can update it), it displays the

Talk2:

on your confirmation page this text is displayed on span or textbox?

Talk3:

If you want to display it on span then you have to replace other wise you bind value in textbox as it.

Talk4:

On my confirmation page it is displayed in a

Talk5:

I think you should display text in to textarea readonly in your confirmation page. so no need to replace words.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值