我这里有一个由输入框和文本区域组成的代码,但是当我要调用名称为 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;
}
}