简体   繁体   English

asp.net 多行文本框默认值

[英]asp.net multiline textbox default value

I am having a problem with the asp.net multi line textbox我在使用 asp.net 多行文本框时遇到问题

<asp:TextBox ID="Oohrl" 
    runat="server"
    CssClass="textEntry"
    ClientIDMode="Static"
    Text="{/oohru/form/oohrl}">
</asp:TextBox>

This works fine with text= when the page loads it puts the appropriate value in there from the XML file这适用于 text= 当页面加载时它会从 XML 文件中放入适当的值

However the following does NOT do that但是,以下内容不会那样做

<asp:TextBox id="Description"
    TextMode="MultiLine"
    Columns="50"
    Rows="4"
    runat="server"
    ClientIDMode="Static"
    Text="{/oohru/form/desc}">
</asp:TextBox>

it just puts {/oohru/form/desc} as the literal text inside of the textbox.它只是将 {/oohru/form/desc} 作为文本框内的文字文本。 The multi line box renders as a textarea vs an input in the first example.在第一个示例中,多行框呈现为文本区域与输入。

Below is how the xhtml is constructed on the browser This is the one that works, where asdf IS the proper value that it should display下面是如何在浏览器上构建 xhtml 这是一个有效的方法,其中 asdf 是它应该显示的正确值

<input class="textEntry" 
    id="Oohrl"
    value="asdf" 
    name="ctl00$RightColumn$Oohrl" 
    type="text">

This is the one that doesn't这是不

<textarea id="Description" 
    cols="50" 
    rows="4" 
    name="ctl00$RightColumn$Description">
    {/oohru/form/desc}
</textarea>

I did also try using my own textarea with runat="server" and another without that, it still won't put a value in. Is there a reason xslt won't render a value into a text area??我也尝试过使用我自己的 textarea 和 runat="server" 而另一个没有,它仍然不会输入值。xslt 不会将值渲染到文本区域是否有原因?

You can use Ajax TextBoxWaterMark Control to solve this issue.您可以使用Ajax TextBoxWaterMark 控件来解决此问题。 You need not use classes for this.你不需要为此使用类。

  • everything which you write in double-course for text property, it shown as default text for that,so you are getting like that您在双课程中为 text 属性编写的所有内容,它都显示为默认文本,所以您会这样

  • see the link below might it will help here请参阅下面链接可能会有所帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM