我试图将数据库中的文本加载到许多文本字段中
<asp:TextBox ID="descriptiont" runat="server" Rows="3" Width="300px" Height="100px" Wrap="true">这就是它背后的代码
descriptiont.Text = s.GetValue(1).ToString();
descriptiont.Enabled = false;这就是我在网页上得到的

原文为"ECASTI (埃及科学、技术和创新促进中心)“
有人能帮忙吗?!
发布于 2015-01-02 18:20:16
用这个:
<asp:TextBox id="TextArea1" TextMode="multiline" Columns="50" Rows="5" runat="server" />然后您可以通过以下方式访问内容:
string message= TextArea1.Text;发布于 2015-04-20 05:36:16
不要固定文本框的高度。高度应该是auto.And在css添加属性的文本框。看起来不错。
word-wrap: break-word;发布于 2015-01-02 18:27:20
试试这个:
string s = "Your Text Field";
if (s.Length > 20)
{
//Change Width="450px"
}最新情况:
当文本长度大于字段长度时,可以更改CSS中的宽度。
更新2:
可以使用以下代码调整C#中的文本框的大小:
if (s.Length>20)
{
textBox1.TextChanged += textBox1_TextChanged;
}
void textBox1_TextChanged(object sender, EventArgs e)
{
Size size = TextRenderer.MeasureText(textBox1.Text, textBox1.Font);
textBox1.Width = size.Width;
}https://stackoverflow.com/questions/27746617
复制相似问题