-1

I am opening one edit Profile page in my view. I want to display skills of the person in his profile Page; his skills are stored in another table. Now I want to open one Partial View to show his skills. Please help me how to show the partial View.

Thanks in advance.

Saloni
  • 525
  • 2
  • 12
  • 31

2 Answers2

2

If I am not wrong in understanding your question, then I think you just to use

    @Html.Action("Skills","Profile", new { id = 1 })

where "Profile" is your controller and "Skills" is your action.

You can get skills for profile by passing ID of profile to that action and from that action you can use

    return Partial(model);
Ruchir Shah
  • 316
  • 2
  • 8
0

The question is a big vague, but assuming you have a model declared in parent view with a property called Skills, then you can pass stuff to partial view like this:

@{ Html.RenderPartial("SkillsForm", Model.Skills); }
Mike Trusov
  • 1,958
  • 1
  • 15
  • 23
  • i am defining model as @model MVCJobs.Models.Profiles please tell me how can i RenderPartial – Saloni Oct 29 '12 at 06:36
  • i am facing error **System.Web.Mvc.HtmlHelper' has no applicable method named 'RenderPartial' but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax.** – Saloni Oct 29 '12 at 06:43
  • There's a number of reasons you can be getting the error, so I can't really give you a straight answer, so... refer to http://stackoverflow.com/questions/4047543/render-partial-view-with-dynamic-model-in-razor-view-engine-and-asp-net-mvc-3 and http://stackoverflow.com/questions/4524267/renderpartial-from-different-folder-in-razor for more details – Mike Trusov Oct 29 '12 at 07:03