如何从asp C#中的textarea获取价值? [英] How to get value from textarea in asp C#?

查看:81
本文介绍了如何从asp C#中的textarea获取价值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用asp页面中的文本区域。我在代码后面的某个位置卡住了我无法获得价值。任何人都可以帮助我吗?

解决方案

给你的控件一个名字 -

< textarea name =contentid =contentcols =50rows =10runat =server>< / textarea>



在代码隐藏中,设置值

  string  strVal; 
strVal = content。 value ;


参考: find-div-tag-from-code-behind [ ^ ]


使用< pre lang =c#> Request.Form( yourControl





如果你正在使用html textarea控件,

add

 runat =   server 

并像普通文本框一样访问它。



使用带有TextMode =Multiline属性的aspx文本框。


I am using text area in asp page.I stuck at one point in code behind I am not able to get value.Can any one help me?

解决方案

Give your control a name -
<textarea name="content" id="content" cols="50" rows="10" runat="server"></textarea>

In the codebehind, set the value

string strVal;
strVal = content.value;


Refer: find-div-tag-from-code-behind[^]


Use

Request.Form("yourControl")


or
If you're using html textarea control,
add

runat="server"

and access it like normal textbox.
or
use aspx textbox with TextMode="Multiline" property.


这篇关于如何从asp C#中的textarea获取价值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆