无法从文本区域获取文本 asp.net
Can't take text from a textarea asp.net
我在 aspx 页面中声明了以下文本区域
Continut:<TextArea maxlength="4000" ID="Continut" name="Continut" runat="server" style="background-color: white; border : 1px solid #cccccc; width : 700px; height : 250px; resize : none;"></TextArea>
并且我想在 C# 中从这个文本区域获取文本。我在 C# 中使用的代码如下所示
this.Request.Form["Continut"].Length < 1? "":this.Request.Form["Continut"]
有没有我做错了什么或者我只是没有完全理解它是如何工作的?
P.S。 :我尝试使用另一个代码,但出现错误:"System.Web.UI.HtmlControls.HtmlTextArea' does not contain a definition for 'Text'"。
代码是:
this.Continut.Text.Length < 1? "Document":this.Continut.Text
Ad1) 确保您的控件 "Continut" 在表单内。
Ad2) 你应该使用 Value 属性
http://msdn.microsoft.com/en-us/library/system.web.ui.htmlcontrols.htmltextarea.value(v=vs.110).aspx
我在 aspx 页面中声明了以下文本区域
Continut:<TextArea maxlength="4000" ID="Continut" name="Continut" runat="server" style="background-color: white; border : 1px solid #cccccc; width : 700px; height : 250px; resize : none;"></TextArea>
并且我想在 C# 中从这个文本区域获取文本。我在 C# 中使用的代码如下所示
this.Request.Form["Continut"].Length < 1? "":this.Request.Form["Continut"]
有没有我做错了什么或者我只是没有完全理解它是如何工作的?
P.S。 :我尝试使用另一个代码,但出现错误:"System.Web.UI.HtmlControls.HtmlTextArea' does not contain a definition for 'Text'"。 代码是:
this.Continut.Text.Length < 1? "Document":this.Continut.Text
Ad1) 确保您的控件 "Continut" 在表单内。
Ad2) 你应该使用 Value 属性
http://msdn.microsoft.com/en-us/library/system.web.ui.htmlcontrols.htmltextarea.value(v=vs.110).aspx