How to maintain the indexing in html when posting data to server in asp.net mvc?

91 Views Asked by At

I have a form made in html which is used to crate heading and text. suppose I click on button for add heading and then on another button for adding text.

Now I have a heading (input type="text") and I have a text (which is textarea). using jQuery sortable plugin I make them up down in the html page.

Now my problem is user can up down the heading and text. I want to generate html on the back and create the html.

Now in the code how I can find which one come first, head or text. I first try with looping the Request.Form and generate the html.

If I use Request.Form approach there will be one key for every key, for example.

<input type="text" name="head"/>

Request.form join them with comma, What about if someone enter it with comma. How I can separate them. If someone have workaround for this, please help.

  1. 2nd idea is using input like head[], this way I can use them in parameter like List head, (in ActionResult). My problem still remain same, How I can figure out which come first "head" or "text".

Is there anyway to figure out on server which input tag come first.

Thanks

0

There are 0 best solutions below