このガイド (http://www.asp.net/ajaxlibrary/act_AutoComplete_simple.ashx) に従ってオートコンプリート エクステンダーを使用しましたが、これは機能しますが、より大きなプロジェクトに実装するときは、一生違いがわかりません。 . エクステンダーをテーブル要素と入れ子にするのは問題ですか?
とにかく、チュートリアルからダンビーメソッドを呼び出すオートコンプリートエクステンダーを持っています。Webサービスを使用するのではなく、メソッドのみを使用します(ガイドのように)。このページはマスター ページを使用していますが、それによって問題が発生することがわかっていますか? ヘッダーはこちら
<%@ Page Title="Report" Language="C#" MasterPageFile="~/Doctors/MasterPage.master" AutoEventWireup="true" CodeFile="generateReport.aspx.cs" Inherits="Doctors_generateReport"
maintainScrollPositionOnPostBack="true" %>
<style>...</style>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
<asp:toolkitscriptmanager ID="ToolkitScriptManager1" runat="server" >
</asp:toolkitscriptmanager>
<p class="headingStyle"><strong><em>Clinical Report</em></strong></p>
<table>
そしてテキストボックス:
<td class=logicalDivide>Current Medication:</td>
<td class=logicalDivide>
<asp:TextBox ID="tbCMed" runat="server" CssClass="textbox" Width="178px" MaxLength="30" Font-Names="Calibri" onfocus="{ this.value = ''; }"></asp:TextBox>
<asp:autocompleteextender
ID="AutoCompleteExtender1"
runat="server"
TargetControlID="tbCMed"
ServiceMethod="GetCompletionList4" UseContextKey="True">
</asp:autocompleteextender>
</td>
および背後にあるコード:
[WebMethod]
[ScriptMethod]
public static string[] GetCompletionList4(string prefixText, int count, string contextKey)
{
// Create array of movies
string[] movies = { "Star Wars", "Star Trek", "Superman", "Memento", "Shrek", "Shrek II" };
// Return matching movies
return movies.Where(m => m.StartsWith(prefixText, StringComparison.CurrentCultureIgnoreCase)
.Take(count)
.ToArray();
}
編集 1: この質問は似ています (http://stackoverflow.com/questions/791361/trying-to-get-a-simple-example-of-asp-net-ajax-dropdownlist-autocomplete-extende?rq=1)しかし、デモのように、それ自体は機能しますが、私のアプリケーションでは機能しません。
したがって、ツールキットの動作を変更する Masterpage または web.config の設定である必要があります。何か案は ?
編集 2: ToolScriptManager をマスター ページに配置しようとしました - ダイスはありません。そして...追加
EnabledPageMethods="true"
ToolScriptManager に - まだサイコロはありません。
web.config からの最後の関連スニペット:
<pages>
<controls>
<add tagPrefix="asp" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit"/>
</controls>
</pages>
<identity impersonate="true"/>