我是asp.net MVC的新手,在app中我需要通过ajax调用操作和更新容器div,我该怎么办?
<div id="updateContainer">
</div>
@foreach(string str in new[] {"All", "Joe", "Jane", "Bob"}){
<div>
@Ajax.ActionLink(str,"ApprointmentData", new {id= str })
</div>
}
答案 0 :(得分:3)
你应该使用ajax选项
@foreach(string str in new[] {"All", "Joe", "Jane", "Bob"}){
<div>
@Ajax.ActionLink(str,"ApprointmentData", new {id= str },
new AjaxOptions{
UpdateTargetId="updateContainer",
}
)
</div>
}
答案 1 :(得分:0)
@Ajax.ActionLink("Link Text", "MyAction", "MyController", new { month = "January"},new AjaxOptions{UpdateTargetID="YourUID here"}