1

I'm new in asp.net MVC and in app I need call action and update container div via ajax, How can I do it?

<div id="updateContainer">
</div>

@foreach(string str in new[] {"All", "Joe", "Jane", "Bob"}){
  <div>
    @Ajax.ActionLink(str,"ApprointmentData", new {id= str })
  </div>
 }
tereško
  • 58,060
  • 25
  • 98
  • 150

2 Answers2

3

you should to use ajax options

@foreach(string str in new[] {"All", "Joe", "Jane", "Bob"}){
  <div>
    @Ajax.ActionLink(str,"ApprointmentData", new {id= str },
      new AjaxOptions{ 
            UpdateTargetId="updateContainer",
      }
    )
  </div>
 }
Hadi Sharifi
  • 1,497
  • 5
  • 18
  • 28
0
@Ajax.ActionLink("Link Text", "MyAction", "MyController", new { month = "January"},new AjaxOptions{UpdateTargetID="YourUID here"}
Sai Avinash
  • 4,683
  • 17
  • 58
  • 96