【发布时间】:2012-12-12 03:47:35
【问题描述】:
我尝试使用带有 C# 数据源的 Kendo UI 自动完成工具。 在 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 文件或类似文件,您知道如何完成此操作吗?
我不想创建一个附有模型等的控制器...如果可以只用一页制作它,那就太好了。
【问题讨论】:
-
为什么不使用asp.net网页,将所有的逻辑和视图呈现在同一个页面,或者使用asp.net网页表单?
标签: php asp.net razor autocomplete kendo-ui