C# データソースで Kendo UI Autocomplete ツールを使用しようとしています。PHPでは非常に簡単に思えます:
<?php
include("connection.php");
$arr = array();
$stmt = $db->prepare("SELECT StateID, StateName FROM USStates WHERE StateName LIKE ?");
// get the StartsWith value and append a % wildcard on the end
if ($stmt->execute(array($_GET["StartsWith"]. "%"))) {
while ($row = $stmt->fetch()) {
$arr[] = $row;
}
}
// add the header line to specify that the content type is JSON
header("Content-type: application/json");
echo "{\"data\":" .json_encode($arr). "}";
?>
しかし、私は CSHtml ファイルまたは同等のものを使用したいのですが、これを達成する方法について何か考えがありますか?
模型などに付属するコントローラーを作りたくない… 1ページだけで作れたら良いのですが。