Is it possible to have one view for two action in asp.net mvc3 razor view? -
i need add time zone in view.
dynamic viewdata = new expandoobject(); viewdata.timezones = p in timezoneinfo.getsystemtimezones() select new selectlistitem { text = p.displayname, value = p.id };
how can send "viewdata" view. have done in different action, cannot in same action.
you use viewbag
:
public actionresult index() { viewbag.timezones = p in timezoneinfo.getsystemtimezones() select new selectlistitem { text = p.displayname, value = p.id }; return view(); }
and in view:
@html.dropdownlist( "selectedtimezone", (ienumerable<selectlistitem>)viewbag.timezones )
Comments
Post a Comment