Click here to Skip to main content
13,088,846 members (66,028 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
Hi All,


In my web application using javascript i got the selected item from a list. Now i have a partial view . i want to display this partial view with selected data when i click one item in a list.currenlty i am using webapi concept and knockout.js.plz help me
Posted 5-Aug-13 19:46pm
josh-jw17.3K
Updated 5-Aug-13 21:46pm
v2

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Remember - partial view stayed on server.

so look into retrieving action result using ajax.

<div id="container">
    @Html.Partial("_IndexPartial")
</div>
 
@Ajax.ActionLink("Change data", "Index", "Home", new {}, new AjaxOptions{UpdateTargetId = "container"}, new {someparam = "somevalue"}) 


http://msdn.microsoft.com/en-us/library/system.web.mvc.ajax.ajaxextensions.actionlink(v=vs.108).aspx[^]

You can also look into loading json packet through web api and render it on client using template (if you are using knockout, kendo, jquery-templates or similar library) etc.

In fact goal can be achieved in number of ways - up to you.
  Permalink  
Comments
josh-jw 6-Aug-13 3:44am
   
i am using knockout js.so how can i do this functionality?
Vyacheslav Voronenko 6-Aug-13 3:48am
   
1. Read knockoutjs manuals
http://knockoutjs.com/documentation/json-data.html
2. Implement WebApi method returning json
3. Capture output, set to model.
4. Enjoy.
josh-jw 6-Aug-13 4:46am
   
In my case i am displaying item selected from the list. i am able to get the selected item. but dont know ,how to call a partial view and bind this data
Vyacheslav Voronenko 6-Aug-13 4:48am
   
Either you create jsFiddle to localize concrete problem, or read documentation with examples on knockout & MVC4. This is something that can be resolved by documentation studying. I have provided you with clues.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web01 | 2.8.170813.1 | Last Updated 6 Aug 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100