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
  • 57,247
  • 24
  • 95
  • 149

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,417
  • 4
  • 17
  • 27
0
@Ajax.ActionLink("Link Text", "MyAction", "MyController", new { month = "January"},new AjaxOptions{UpdateTargetID="YourUID here"}
Sai Avinash
  • 4,623
  • 17
  • 55
  • 94