开发者

Retrieve values on server side from tag-it input

开发者 https://www.devze.com 2023-02-23 06:21 出处:网络
I\'m using tag-it plugin and the trouble is to get the values selected on server side. The tag开发者_开发问答s are put into item[tags][] and I hardly see how I can retreive those values on server side

I'm using tag-it plugin and the trouble is to get the values selected on server side. The tag开发者_开发问答s 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!


This works too:

In markup

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

In code-behind

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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消