| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1124 人关注过本帖
标题:文本框内容无法获取的问题
只看楼主 加入收藏
wzwen
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2008-1-21
收藏
 问题点数:0 回复次数:1 
文本框内容无法获取的问题
标题:文本框内容无法获取的问题



由于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">&nbsp;栏目分类:</td>
    <td style="width: 507px; height: 21px;">
        <asp:DropDownList ID="DropDownList1" runat="server">
        </asp:DropDownList></td>
  </tr>
  <tr class="tabletd3">
    <td style="height: 24px;">&nbsp;文章标题:</td>
    <td style="width: 507px; height: 24px;">
        <asp:TextBox ID="TextBox1" runat="server" Width="400px"></asp:TextBox></td>
  </tr>
  <tr class="tabletd3">
    <td>&nbsp;文章作者:</td>
    <td style="width: 507px;">
       <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
       </td>
  </tr>
  <tr class="tabletd3">
    <td style="height: 19px">&nbsp;文章内容:</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");
    }

}
搜索更多相关主题的帖子: 文本框 quot 获取 body form 
2008-02-12 09:28
lbnnbs
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2008-2-12
收藏
得分:0 
runat=server
<textarea id="TextArea1" cols="20" rows="2" runat="server" ></textarea>

dim textarea_value as string=textarea1.value
2008-02-12 21:40
快速回复:文本框内容无法获取的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.025993 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved