Performance in mvc


What are the steps to be followed to increase the performance while rendering a view.

In my view , i have below code scenarios

@if (Model.AccountID == 0)
@Html.DropDownListFor(m => m.ProgramID, Enumerable.Empty<SelectListItem>(),
"–Select–", new { @id = "programID", @class = "chosen form-control drop_downArrow", @name = "programID", @onchange = "ChangeProgram();" })

@Html.DropDownListFor(m => m.ProgramID, new SelectList(ExtensionMethods.GetProgramsByID(Model.ClientID), "Value", "Text"),
"–Select–", new { @id = "programID", @class = "chosen form-control drop_downArrow", @name = "programID", @onchange = "ChangeProgram();" ,@readonly="readonly" })

what’s wrong in the above code which effect the performance




How many items do you have in the drop down? What is the bad behavior you see?

Hey Vijay,

This logic should be done on the server side. Only send the view what needs to be displayed. There shouldn’t be any logic there.


Hi Vijay,

         Can you paste your actionmethod controller code. Cause there shouldnt be any performance issue. When you do this we would be able to assist you. For now, It had for anyone to tell were the problem is.

Leave a Reply