Naz
Naz

Reputation: 5144

Retrieve values on server side from tag-it input

I'm using tag-it plugin and the trouble is to get the values selected on server side. The tags are put into item[tags][] and I hardly see how I can retreive those values on server side in my controller. The post form data looks like this : item%5Btags%5D%5B%5D and then goes the string with the name of the tag. The question is how do I name the variable on the server side so I can access those tag values. It should look something like string[] tags I think.


Thank you for your help!

Upvotes: 0

Views: 360

Answers (2)

RJB
RJB

Reputation: 2103

This works too:

In markup

 <ul id="ul_Tags" name="ul_Tags"></ul>

In code-behind

 string[] tags = Request.Form["ul_Tags"].Split(',');

Upvotes: 1

Naz
Naz

Reputation: 5144

Ok. Think I made it myself. I added model binder for "item[tags][]" key. And it now works just fine. Looks like this [Bind(Prefix = "item[tags][]")] string[] tags

Upvotes: 0

Related Questions