title: Asp.net Mvc Convert return Action result(view) to string
body: <p>I am working on a project in asp.net mvc3(c#).</p>
  
  <p>I need a solution for convert a view(not a partial view) to string from different controllers.</p>
  
  <blockquote>
    <p>Code Explantion:</p>
  </blockquote>
  
  <p>1) Calling "details" action of proposalmoduleController  from proposalsController.</p>
  
  <p>2) proposalmoduleController action "details" returns a view and convert this view(return result) as a string in proposalsController.</p>
  
  <p>Code </p>
  
  <pre><code>public class proposalmoduleController : ControllerBase
  {   
  
     [HttpGet]
      public ActionResult details(int id, int widgetuniqueid)
      {
          //id - widgetid of div container
          List&lt;ModuleViewModel&gt; listmoduleviewmodel = new List&lt;ModuleViewModel&gt;();
          List&lt;ModuleFieldViewModel&gt; listmodulefieldviewmodel = new List&lt;ModuleFieldViewModel&gt;();
  
          var objProposalModuleService = new ProposalModuleService();
          var objModuleViewModel = new ModuleViewModel();
  
          string WidgetTitle = "";
          Int64 ModuleTemplateID = 0;
  
  
          //objModuleViewModel.ProposalID = proposalid;
          objModuleViewModel.ProposalModuleWidgetID = id;
  
          listmoduleviewmodel=objProposalModuleService.Select(1, objModuleViewModel,out listmodulefieldviewmodel, out WidgetTitle, out ModuleTemplateID);
  
          return View(listmoduleviewmodel);
      }
  }
  
      public class proposalsController : ControllerBase
      {
          public string SaveHtml(int ProposalID)
          {
              var objProposalSortOrderViewModelList = new List&lt;ProposalSortOrderViewModel&gt;();
              proposalmoduleController objModuleController = new proposalmoduleController();    // Initilize the object of proposalmoduleController for accessing details method
  
              objProposalSortOrderViewModelList = GetProposalSortorders(ProposalID);
  
              string result;
              foreach (var item in objProposalSortOrderViewModelList)
              {
                   ViewResult viewResult = (ViewResult)objModuleController.details(Convert.ToInt32(item.KeyID), Convert.ToInt32(item.SortOrder));  // Fetch the result returned from proposalmodulecontroller,details action
                   result=viewResult.ToString();         // Need to get result fetch from the proposalmodulecontroller,details action as a string
              }
          }
      }
  enter code here
  </code></pre>
  
  <p>Please suggest any solution.</p>