0
我不能得到使用Telerik的Telerik。錯誤!所請求的URL返回12030-
在這裏工作,我的網是我的代碼:
模型
public class Office
{
public int OfficeID { get; set; }
public string OfficeName { get; set; }
public string OfficeAddress { get; set; }
}
視圖模型
public class OfficeViewModel
{
public int OfficeID { get; set; }
public string OfficeName { get; set; }
public string OfficeAddress { get; set; }
}
VIEW
@(Html.Telerik().Grid<Office>()
.Name("Offices")
.ToolBar(tb => tb.Insert())
.DataBinding(binding => binding.Ajax()
.Select("GetOffice", "Office")
.Update("UpdateOffice", "Office")
.Insert("InsertOffice", "Office")
.Delete("DeleteOffice", "Office"))
.DataKeys(keys => keys.Add(o => o.OfficeID))
.Columns(cols =>
{
cols.Bound(c => c.OfficeID).ReadOnly();
cols.Bound(c => c.OfficeName).Width(20);
cols.Bound(c => c.OfficeAddress).Width(70);
cols.Command(cmd =>
{
cmd.Edit();
cmd.Delete();
});
})
)
CONTROLLER
public ActionResult Index()
{
ViewBag.Message = "Welcome to ASP.NET MVC!";
return View();
}
[GridAction]
public ActionResult GetOffices()
{
return View(new GridModel(GetOfficeViewModels()));
}
private IQueryable<OfficeViewModel> GetOfficeViewModels()
{
return db.Offices
.Select(
c => new OfficeViewModel
{
OfficeID = c.OfficeID,
OfficeName = c.OfficeName,
OfficeAddress = c.OfficeAddress
});
}
最後,佈局。
<li>@Html.ActionLink("Office", "Index", "Office")</li>
請幫我解決這個問題我已經花了很多時間在這個上。我只是個初學者:(
感謝
最近你遇到的問題是什麼 – Rafay 2012-03-31 20:26:08