Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Html.TextBoxFor for repeated properties in the model
- Public Class SampleData
- Public Property PTY_1 as String
- Public Property PTY_2 as String
- Public Property PTY_3 as String
- '...snipped
- Public Property PTY_19 as String
- Public Property PTY_20 as String
- End Class
- <tr><td>@Html.TextBoxFor(Function(model) model.PTY_1)</td></tr>
- <tr><td>@Html.TextBoxFor(Function(model) model.PTY_2)</td></tr>
- <tr><td>@Html.TextBoxFor(Function(model) model.PTY_3)</td></tr>
- '...snipped
- <tr><td>@Html.TextBoxFor(Function(model) model.PTY_19)</td></tr>
- <tr><td>@Html.TextBoxFor(Function(model) model.PTY_20)</td></tr>
- Public Class SampleData
- Public Property PTY(index as Integer) as String
- Get
- Select Case index
- Case 1 : Return PTY_1
- Case 2 : Return PTY_2
- Case 3 : Return PTY_3
- '...snipped
- Case 19 : Return PTY_19
- Case 20 : Return PTY_20
- Case Else : Return ""
- End Select
- End Get
- Set (value as String)
- Select case index
- Case 1 : PTY_1 = value
- Case 2 : PTY_2 = value
- Case 3 : PTY_3 = value
- '...snipped
- Case 19 : PTY_19 = value
- Case 20 : PTY_20 = value
- End Select
- End Set
- End Property
- End Class
- @For index as Integer = 1 to 20
- <tr><td>@Html.TextBoxFor(Function(model) model.PTY(index))</td></tr>
- End For
- @Html.EditorForModel()
- <DataType(DataType.MultilineText)> _
- <UIHint("CustomTextArea")> _
- Public Property PTY_1 as String
- ...
- <tr><td>@Html.TextArea("")</td></tr>
- @for (int i = 1; i <= 20; i++)
- {
- string name = "PTY_" + i;
- <tr><td><input type="text" name="@name" /></td></tr>
- }
Add Comment
Please, Sign In to add comment