Click here to Skip to main content
15,897,334 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
I want to call a function from view page.
C#
@Html.Action("check", "EventController");

and check execute that function
C#
[ChildActionOnly]
      [ActionName("check")]
      public void checkevent()
      {
          int e=0;
         // return View(db.EventManagers.ToList());
      }

I am following this approach, but its giving errors.

Please tell me how can I do it ?
Posted
v2

1 solution

Use Html.RenderAction and Html.Action.Both of these methods allow you to call into an action method from a view and output the results of the action in place within the view. The difference between the two is that Html.RenderAction will render the result directly to the Response (which is more efficient if the action returns a large amount of HTML) whereas Html.Action returns a string with the result.Please check this link you get more idea
http://haacked.com/archive/2009/11/17/aspnetmvc2-render-action.aspx[^]
 
Share this answer
 
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900