简体   繁体   English

从标签输入中检索服务器端的值

[英]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. 我正在使用tag-it插件,麻烦是要在服务器端选择选定的值。 The tags are put into item[tags][] and I hardly see how I can retreive those values on server side in my controller. 标签被放入item[tags][] ,我几乎看不到如何在控制器的服务器端检索这些值。 The post form data looks like this : item%5Btags%5D%5B%5D and then goes the string with the name of the tag. 邮寄表单数据如下所示: item%5Btags%5D%5B%5D ,然后输入带有标签名称的字符串。 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. 我认为它应该看起来像string[] tags


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. 我为“ item [tags] []”键添加了模型绑定器。 And it now works just fine. 现在它可以正常工作了。 Looks like this [Bind(Prefix = "item[tags][]")] string[] tags 看起来像这样[Bind(Prefix = "item[tags][]")] string[] tags

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM