文本框内容无法获取的问题
标题:文本框内容无法获取的问题由于Visual Studio 2005自带的TextBox太弱智了,不要说设置文本格式,就连最基础的换行功能都没法子实现
所以本人决定用textarea
现在问题来了,就是无法获取这个textarea里的文本,真是晕死
请各位官人请看前后台代码,帮助小弟以解迷惑
【前台代码】:
<body>
<form id="form1" runat="server">
<div>
<br />
<table border="1" align="center" cellpadding="0" cellspacing="0" class="tableall" bordercolor="#666666">
<tr>
<td colspan="2" class="tabletd1" style="background-color: #666666; text-align: center">
<span style="font-size: 14pt; color: #ffffff"><strong>添加文章信息</strong></span></td>
</tr>
<tr class="tabletd2">
<td width="20%" style="height: 21px"> 栏目分类:</td>
<td style="width: 507px; height: 21px;">
<asp:DropDownList ID="DropDownList1" runat="server">
</asp:DropDownList></td>
</tr>
<tr class="tabletd3">
<td style="height: 24px;"> 文章标题:</td>
<td style="width: 507px; height: 24px;">
<asp:TextBox ID="TextBox1" runat="server" Width="400px"></asp:TextBox></td>
</tr>
<tr class="tabletd3">
<td> 文章作者:</td>
<td style="width: 507px;">
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</td>
</tr>
<tr class="tabletd3">
<td style="height: 19px"> 文章内容:</td>
<td style="width: 507px; height: 19px;">
<textarea name="wyx_Content" style="display:none" rows="1" cols="20"></textarea></td>
</tr>
<tr class="tabletd2">
<td colspan="2" style="text-align: center">
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="提交" /> <input id="Reset1" type="reset" value="清除" /></td>
</tr>
</table>
</div>
</form>
</body>
【后台代码】:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class admin_admin_add : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
string username = (string)Session["username"];
}
DataSet ds = Socut.Data.ExecuteDataSet("select wyx_id,wyx_classname from wyx_class");//实例化DataSet
DropDownList1.DataSource = ds;
DropDownList1.DataTextField = "wyx_classname";
DropDownList1.DataValueField = "wyx_id";
DropDownList1.DataBind(); //绑定数据
}
protected void Button1_Click(object sender, EventArgs e)
{
string strDate = System.DateTime.Now.ToString();//当前时间
Socut.Data.ExecuteNonQuery("INSERT INTO wyx_text (wyx_title,wyx_author,wyx_content,wyx_date,wyx_class) VALUES ('" + TextBox1.Text + "','" + TextBox2.Text + "','" + wyx_Content + "','" + strDate + "','" + DropDownList1.SelectedItem.Value + "')");
Response.Redirect("admin_text.aspx");
}
}