I create form dynamically on the client side.
I want to iterate it, but know how many fields were created only in client runtime.
based on
http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspxIn ASP.net
I want to add some data to the model
<% for (int i = 0; i < **3**; i++) { %>
how can I make the loop run someClientVar times?
Update:
this is my scenario:
The client has an “expand” button.
It adds unknown number of fields to a form.
I wanted to submit them via a model (I created an object with many fields).
in addition there are some not shown to the UI kind of
‘current context’ data I want to send the server as well.
There’s a disconnect of context here that seems to go misunderstood:
By the time your client script has had a chance to create the variable you wish to use, the server side code, by definition, has already executed. It would be kind of possible the other way around, but not this way.
If you could provide more information on your scenario, such as what data the form is constructed from, then a solution could possibly be provided. As it stands, one can’t (short of using sheer guesswork).