RenderPartial Problem

Last post 02-24-2009 1:41 PM by TobiR. 0 replies.

Sort Posts:

  • RenderPartial Problem

    02-24-2009, 1:41 PM
    • Member
      point Member
    • TobiR
    • Member since 02-17-2009, 3:48 AM
    • Posts 9

    Hi

    When clicking on a catalog item the following code RenderPartial  in ViewExtentions.cs is crashing out with {"Parameter count mismatch."} I have updated to RC of MVC and MVC futures and it seems to all compile ok.

    Any help, much appreciated.

    public static void RenderPartial(this HtmlHelper helper, string partialName, object model, object viewData)
    {
         ViewDataDictionary viewDictionary = new ViewDataDictionary();
         System.Reflection.PropertyInfo[] props = viewData.GetType().GetProperties();
         foreach (PropertyInfo pi in props)
         {
            if (!viewDictionary.ContainsKey(pi.Name))
              viewDictionary.Add(pi.Name, pi.GetValue(viewData, null));
         }

         helper.RenderPartial(partialName, model, viewDictionary);
    }

    Regards

    Toby.

    Filed under: ,
Page 1 of 1 (1 items)