runat = "server"를 사용하여 버튼 클릭 이벤트에서 보이지 않거나 볼 수있는 입력 태그 type = "text" 다음은 runat = "server"를 사용하여 코드 숨김으로 html 입력 텍스트 컨트롤을 설정하는 방법
내가 아약스 다음은/눈에 보이는 보이지 않는하지만, 할 수 있어요 RUNAT = "서버"를 사용하는 경우[WebMethod]
public static List<string> GetAutoCompleteData(string Col3)
{
List<string> result = new List<string>();
if ((dtClone != null) && (dtClone.Rows.Count > 0))
{
DataRow[] foundRows;
string expression = "Col3 LIKE '%" + Col3 + "%'";
// Use the Select method to find all rows matching the filter.
foundRows = dtClone.Select(expression);
for (int i = 0; i < foundRows.Length; i++)
result.Add(foundRows[i][2].ToString());
}
return result;
}
뒤에
$(document).ready(function() {
SearchText();
});
function SearchText()
{
$(".autosuggest").autocomplete({
source: function (request, response) {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "CalenderDetails.aspx/GetAutoCompleteData",
data: "{'Col3':'" + document.getElementById('txtSearch').value + "'}",
dataType: "json",
success: function (data) {
response(data.d);
},
error: function (result) {
alert("Error");
}
});
}
});
}
</script>
<asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" />
<br />
<input type="text" id="txtSearch" class="autosuggest" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" >
<ContentTemplate>
<asp:Label ID="Label3" runat="server" Text="Label"></asp:Label>
<br />
<br />
<asp:GridView ID="Gr
idView1" runat="server" AllowPaging="True" PageSize="20" OnPageIndexChanging="GridView1_PageIndexChanging" OnRowDataBound="GridView1_RowDataBound">
<HeaderStyle BackColor="#FFCC99" />
</asp:GridView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="GridView1" EventName="PageIndexChanging" />
<asp:AsyncPostBackTrigger ControlID="btnSubmit" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
코드를 코딩 것입니다 전화가 검색 작업을 수행하지 않습니다
어떤 문제가이 문제를 해결할 수 있습니까?
코드에서 jQuery 메서드를 호출 할 수 있습니다. –
아무도 도와 줄 수 있습니까? –