placeholder="(e.g. 1, (in new line)2,(in new line)3,(in new line)4, ...)"
示例:文本框看起来像:
如何继续使用此占位符的下一行?
答案 0 :(得分:1)
首先将文本框的TextMode
设置为MultiLine
:
<asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" Rows="3"></asp:TextBox>
您可以在Page_Load
方法中添加placeholder
属性并使用Environment.NewLine
或字符串文字&#34; \r\n
&#34;添加换行符。像:
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Attributes.Add("placeholder", "1,"+Environment.NewLine+"2," + Environment.NewLine + "3,");
//or using \r\n:
TextBox1.Attributes.Add("placeholder", "1,\r\n2,\r\n3,");
}
输出结果为:
希望它会帮助你......!