jQueryオートコンプリートで使用するプレーンテキストを提供するHTTPHandlerの構築に取り組んでいます。テキストの最初のビットを挿入したときにアルファベットの正しい部分に移動しないことを除いて、現在は機能しています。
例:入力した場合Ne
私のドロップダウンリターン
Nlabama
Arkansas
「Alabama」の「N」Ne
と「labama」に注目してください。
3番目の文字を入力するとNew
、jQueryは結果の「N」セクションを返します。
私の現在のコードは次のようになります
Public Sub ProcessRequest(ByVal context As System.Web.HttpContext) Implements System.Web.IHttpHandler.ProcessRequest
''# the page ContentType is plain text
HttpContext.Current.Response.ContentType = "text/plain"
''# store the querystring as a variable'
Dim qs As Nullable(Of Integer) = Integer.TryParse(HttpContext.Current.Request.QueryString("ID"), Nothing)
''# use the RegionsDataContext'
Using RegionDC As New DAL.RegionsDataContext
''# create a (q)uery variable'
Dim q As Object
''# if the querystring PID is not blank'
''# then we want to return results based on the PID'
If Not qs Is Nothing Then
''# that fit within the Parent ID'
q = (From r In RegionDC.bt_Regions _
Where r.PID = qs _
Select r.Region).ToArray
''# now we loop through the array'
''# and write out the ressults'
For Each item In q
HttpContext.Current.Response.Write(item & vbCrLf)
Next
End If
End Using
End Sub
ですから、私が今いるのは、オートコンプリートメソッドの「パート」の部分に出くわしたという事実です。これにより、パートに含まれている情報のみを返す必要があります。
私の質問は、文字を変更するたびに新しいSQLQueryを実行せずに、この概念をHTTPHandlerに実装するにはどうすればよいでしょうか。IE: QueryString( "ID")でSQLクエリを実行し、その後同じIDをロードするたびに、"Part"をフィルターで絞り込みます。
http://www.example.com/ReturnRegions.axd?ID=[someID]&Part=[string]