textarea的控制,asp.net C# [英] textarea control, asp.net c#
问题描述
我使用textarea的控制,允许用户输入文本,然后将该文本放置到电子邮件的正文。在code的背后,究竟是什么引用用户输入的语法。我想我可以只使用message.Body = test123.Text;但是这不被认可。
code在aspx页面---
< textarea的ID =TextArea1COLS =20行=2>< / textarea的>
code后面---
的foreach(在收件人串接收方)
{
VAR消息=新System.Net.Mail.MailMessage(sender@example.com,收件人);
message.Subject =的Hello World!;
message.Body = test123.Text;
client.Send(消息);
}
您不使用你的文本区域.NET控件。无论是添加 =服务器
来的HTML TextArea控件或使用.NET控件:
试试这个:
< ASP:文本框的id =TextArea1的TextMode =多行栏目=50行=5=服务器/>
然后在你的codebehind引用它:
message.Body = TextArea1.Text;
i'm using a textarea control to allow the user to input text and then place that text into the body of an e-mail. in the code behind, what is the syntax for referencing the users input. i thought i could just use "message.Body = test123.Text;" but this is not recognized.
code in aspx page ---
<textarea id="TextArea1" cols="20" rows="2" ></textarea>
code behind ---
foreach (string recipient in recipients)
{
var message = new System.Net.Mail.MailMessage("sender@example.com", recipient);
message.Subject = "Hello World!";
message.Body = test123.Text;
client.Send(message);
}
You are not using a .NET control for your text area. Either add runat="server"
to the HTML TextArea control or use a .NET control:
Try this:
<asp:TextBox id="TextArea1" TextMode="multiline" Columns="50" Rows="5" runat="server" />
Then reference it in your codebehind:
message.Body = TextArea1.Text;
这篇关于textarea的控制,asp.net C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!