how to dynamically change the home page in an asp.net mvc application. As with ASP.Net, it can be changed in Page_PreInit Event
Views display a property .MasterNamethat indicates which main page to use. You can set this in your controller when returning the view.
.MasterName
For instance,
public ActionResult Index() { ViewResult vr = View(); vr.MasterName="...."; return vr; }
You can create your own class ViewPageand override the method OnPreInitand set the property accordingly MasterPageFile.
ViewPage
OnPreInit
MasterPageFile
Just change your views to use your own ViewPage class, and you're done.
Source: https://habr.com/ru/post/1746895/More articles:Can Visual Studio 2010 Test.net 3.5 SP1 projects? - .netcompare brush and color - c #Do I need to get rid of MySqlCommand? - mysqlUsing Memcached in Python / Django - questions - python"Microsoft.ACE.OLEDB.12.0" 64x Sql Server and 86x Office? - 64bitCan I get jquery.serializeArray () values by key name? - jqueryusing log4net through stored procedures in oracle - c #Guide for migrating from delayed_job to resque? - ruby-on-railshttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1746899/separating-arguments-to-a-function-in-locales-with-comma-as-decimal-marker&usg=ALkJrhhAdIqAve3ze7aM2RtuHAaLhHm1ygIs there a less bloated way to check for constraints in the grail? - unit-testingAll Articles