1

私のページには、row="" cols="" を必要とする cleEditor があり、runat="Server" を実行すると、asp.net はこれを好まない

これを回避するために、FindControl を使用しようとしましたが、この方法では値を取得できないようです。

これが私のコードです:

protected void os_submit_Click ( object sender, EventArgs e )
{
    Control cleEditor = FindControl( "editor2" );
    MailMessage mm = new MailMessage( "OnlineSignup@help.com", "help@help.com" );
    mm.Subject = "Online Signup Checklist";
    mm.Body = cleEditor.value; // Trying to grab the value of the textarea
    mm.IsBodyHtml = true;
    SmtpClient smtp = new SmtpClient();
    smtp.Host = "127.0.0.1";
    smtp.Port = 25;
    smtp.Send( mm );
}

editor2 の ID を持つ TextArea があります。シーンの背後で jquery がこれをリッチ テキスト エディターに変えます。このテキストエリアの値/テキストを取得できるようにするには、asp.net が必要です。

誰かが私が間違っていることを見ることができますか?

4

1 に答える 1

4

runat="server"TextAreaを配置せず、次のようにします。

protected void os_submit_Click ( object sender, EventArgs e )
{
    MailMessage mm = new MailMessage( "OnlineSignup@help.com", "help@help.com" );
    mm.Subject = "Online Signup Checklist";
    mm.Body = Request.Form["editor2"]; // Trying to grab the value of the textarea
    mm.IsBodyHtml = true;
    SmtpClient smtp = new SmtpClient();
    smtp.Host = "127.0.0.1";
    smtp.Port = 25;
    smtp.Send( mm );
}
于 2012-04-26T17:53:16.373 に答える