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

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -