-2

I have a cshtml file which is reading 2 variables I'm sending it.

It works fine with sending the parameters using ViewDataDictionary from another view using @HTML.Partial. But I am getting 500 errors when I am trying to send the same type of arguments through my function bellow

public ActionResult Refresh(string id){
    return PartialView(page,new ViewDataDictionary { { "points" , get_points(id)) } });
}

My @HTML.Partial looks the sameway, the only thing that is different is the PartialView. I have verified in the debugger that my parameters have the same look.

Why is PartialView generating 500 errors and Partial is not?

  • Possible duplicate of [Initializer syntax: new ViewDataDictionary { { "Name", "Value" } }](https://stackoverflow.com/questions/18608162/initializer-syntax-new-viewdatadictionary-name-value) – MethodMan Jan 05 '18 at 18:39

1 Answers1

0

I was not keeping track in my head of where I was sending the parameters from. I was sending from View To View when I was using ViewDataDictionary. While this time I was trying to send from the controller to the view.

I solved this using ViewData to initiate the variables in the model so that my view could access them.

  • 1
    your self posted answer does nobody any good in my opinion since you posted code originally that was not correctly working, then you post here that you solved it without showing how you solved it either edit your answer or delete it.. or delete the question in general. – MethodMan Jan 05 '18 at 19:11