0

I have an input like ["abc","def","ghi"]. I have to split this into "abc" "def" "ghi" in view of C# MVC. And also i have to display each string value into separate text box of same row.

I have tried like

@Html.TextBoxFor(m => (String.Join(",", m.editPeriodicTask.args))[1], new { @id = "args", @class = "form-control-list" })

but I am not getting the right solution. Can anyone please suggest on this.

Thanks in Advance

Jeya Suriya Muthumari
  • 1,947
  • 3
  • 25
  • 47
sara
  • 115
  • 1
  • 2
  • 15
  • If the 2nd list having ["xxx","yyy"] values means, The third text box will be empty – sara Feb 12 '16 at 04:30

2 Answers2

0

in js u can split array using

var s= arrayname.split(",");
ΦXocę 웃 Пepeúpa ツ
  • 47,427
  • 17
  • 69
  • 97
Anirudh
  • 558
  • 1
  • 6
  • 22
0

This is not exactly what you are looking for, but it seems using loops is the most common way to achieve it.

Asp.net razor textbox array for list items

This link might be helpful, in case of three textboxes, you can loop for 3 times instead of the size of the collection.

Hope it helps.

Community
  • 1
  • 1
SamGhatak
  • 1,487
  • 1
  • 16
  • 27