c# - Create buttons for this dynamic values -
i have controller , controller returns dynamic values.i need create buttons dynamic values.
my contoller
public actionresult loginas() { string[] roles = (string[])tempdata["data"]; // array returns 3 values.i need create buttons values. return view(); }
i have no idea how create buttons dynamic values.mvc
updated (buttons type changed string[]
)
model
public class loginasviewmodel { public string[] buttons {get;set;} }
controller
public actionresult loginas() { //i don't know tempdata returns string[] roles = (string[])tempdata["data"]; var model = new loginasviewmodel { buttons = (string[])tempdata["data"] }; return view(model ); }
view
@model loginasviewmodel @for(int i=0; < model.buttons.count(); i++) { <button>@model.buttons[i]</button> }
Comments
Post a Comment