how do you reuse a partial view with different ids

Posted by oo on Stack Overflow See other posts from Stack Overflow or by oo
Published on 2010-04-04T13:10:33Z Indexed on 2010/04/04 13:13 UTC
Read the original article Hit count: 310

Filed under:
|
|
|

i have a partial view with a dropdown in it. the code looks like this:

 <%=Html.DropDownListFor(x => Model.Exercises, new SelectList(Model.Exercises, "Id", "Name", Model.SelectedExercise), new { @id = "exerciseDropdown", @class = "autoComplete" })%>

the issue is that i want to reuse this partial view in multiple places but i want to have a different id assigned to the control (instead of exerciseDropdown always) but on the outside i only have this . .

 <% Html.RenderPartial("ExerciseList", Model); %>

is there anyway to pass in an id into a partial view. should i stick this into my view model as a seperate property "Model.ExerciseDropdown2" for example.

is there a better way ?

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about partialview