I have two controls Address.ascxon an ASP.NET MVC page.
<h1>Shipping Address</h1>
<% Html.RenderPartial("Controls/AddressControl"); %>
<h1>Billing Address</h1>
<% Html.RenderPartial("Controls/AddressControl"); %>
Of course, with the code, in the same way, I get the same identifiers for each field in the address. I can easily add a string to the field id so I have 'Street1_billing'and 'Street1_shipping', but I don’t understand how to map this to the model.
What is the best solution for comparing a model with an array of elements (in this case only 2). I don't know any ASP.NET out of the box solutions for this.
Note. This is a bit like this question , and I could use this solution from Scott Hanselman , but that’s not quite what I want. In my case, I know that I have two elements, so its essentially 2 arrays of elements, but I wonder if there is a slightly more elegant solution.
PS. I am sure that this has been asked many times before, but I just can’t find the right search terms. Please write this question if you know about it!
source
share