Javascript
function btnNewPatientClick()
{
hidFlag.value = "false";}
function btnExistingPatient_Click()
{
hidFlag.value = "true";}
ASPX..
<asp:TextBox ID="txtPatientID" AutoCompleteType="Disabled" CssClass="csstextbox"
runat="server"></asp:TextBox><span class="csstexterror">*</span>
<asp:AutoCompleteExtender ID="txtPatientID_AutoCompleteExtender" runat="server" ServiceMethod="GetPatientID"
MinimumPrefixLength="1" CompletionSetCount="1" TargetControlID="txtPatientID"
UseContextKey="True" DelimiterCharacters="" Enabled="True">
</asp:AutoCompleteExtender>
C#
static string flag = "";
protected void Page_Load(object sender, EventArgs e)
{
flag = hidFlag.Value;
}
[System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
public static string[] GetPatientID(string prefixText, int count, string contextKey)
{
if(flag == "true"){
///code to get patientID
}
}
我有两个按钮 NEW Patinet,Existing Patinet 和一个文本框用于选择 Patinet 名称使用 ajax 工具包的 autocompleteExtender。如果我点击新学生按钮,那么我不允许在文本框中填充学生,如果点击现有学生,则允许在文本框中填充学生。我设置了标志但失败了解决方案是什么。