c# - ASP.NET MVC - Cannot pass string[] value to another Controller action -
I am trying to get another string array (with two values) from one controller action. But the second action has this value: 'System.String []'
passes the controller action with this value. But when I try to pass the second pass it only passes the empty string.
HTML (razor) @using (HTML.benform ("declaration", "administrator", formmath.post, new {id = "form"})) {// there other Html elements .... and label class = "checkbox-inline" & gt; & Lt; Input type = "checkbox" name = "tag" id = "web" value = "web" check = "check" /> & Lt; Period & gt; Web & lt; / Span & gt; & Lt; / Labels & gt; & Lt; Label class = "checkbox-inline" & gt; & Lt; Input type = "checkbox" name = "tag" id = "ambulance" value = "client" check = "check" /> & Lt; Span & gt; Ambulance Client & lt; / Span & gt; & Lt; / Labels & gt;
Controller:
Public Action Announcement Declaration Process (News Itam News, Guide RSS Editor, Gid Nusamati, String [] Tag) // Tag near variable two The values are: [0]: Web, [1]: Client {.... // I have another action return redirection tiection (Action Name: "Announcements", Root Value: New {tag = Tag}) for existing string [] I want to assume; } // 2 Action Method Public Actionless declarations (string [] tag) {// The value of the tag variable is: [0]: system.STRING []}
I think it is better to use TempData, such as:
public action announcement announcements (News Itam News , Guide RSScattieri, guide NEWSIMAGETYPE, string [] tag) // tag variable has two values: [0]: web, [1]: customer {.... TempData ["tags"] = tag; Redirect return action (verb name: "announcements"); } // 2 Action Methodist Public ActionRultult Announcements () {var tag = (string []) tempadata ["tag"]; } Good luck!
Comments
Post a Comment