存在我這裏有一個代碼,由輸入框和文本區域,但是當我正要打電話給輸入框,其名稱爲txtBxSearch。發生錯誤,它說: 「 'txtBxSearch' 這個名字不會在目前情況下存在」「txtBxSearch」這個名字不會在目前情況下
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div style="padding-top:10px; padding-left:40px;"> <span class="fields">To:</span><br />
<input type="text" id="txtBxSearch" name="txtBxSearch" class="border fields"
style="width:891px;" onclick="return txtBxSearch_onclick()" />
<div style="padding-top:10px; padding-left:40px;"><span class="fields">Text Message:</span><br />
<textarea id="TextArea1" onkeyup="textCounter(this,'counter',160);" cols="20" rows="2" class="fields border" style="height:150px; width:95%;"></textarea>
</asp:Content>
我在C#代碼隱藏
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Data.SqlClient;
using System.Web.Services;
using System.Web.UI.WebControls;
public partial class SMS : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
private string groupKeyword;
private string message;
private int priorityLevel;
private bool isDiagnosticCommand;
private bool concatenate;
private object confirmationDate;
protected void btnSend_Click(object sender, ImageClickEventArgs e)
{
groupKeyword = txtBxSearch.value;
message = TextArea1.Value;
priorityLevel = 253;
//confirmationDate = DateTime.Now.ToShortDateString();
isDiagnosticCommand = false;
concatenate = false;
}
}
可能重複的問題http://stackoverflow.com/questions/564289/read-post-data-submitted-to-asp-net-form – pmtamal