2018-04-24

Getting Current Controller/Action in MVC

Getting Current Controller/Action in MVC



@{
    var controller = ViewContext.RouteData.GetRequiredString("controller");
    var action = ViewContext.RouteData.GetRequiredString("action");
}




https://stackoverflow.com/questions/6398189/getting-current-controller-action-from-within-partial-view

Click Once, Sort by Name, Click Twice Sort by Desc in MVC

Click Once, Sort by Name, Click Twice Sort by Desc in MVC



    ViewBag.NameSortParm = sortOrder == "name" ? "name_desc" : "name";
    // Rest of your sortOrder param goes here...

    var persons = from s in db.PRT_FEE_PRICES
                  select s;
    switch (sortOrder)
    {
        case "name":
            persons = persons.OrderBy(s => s.NAME);
            break;
        case "name_desc":
            persons = persons.OrderByDescending(s => s.NAME);
            break;
        // ...
    }


2018-04-22

Question: How to pass dot parameter to id in MVC

Question: How to pass dot parameter to id in MVC

Solution:
Add following in Web.config

<system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
    <validation validateIntegratedModeConfiguration="false" />
</system.webServer>
  
 
 

https://stackoverflow.com/questions/32392776/can-i-pass-dot-as-parameter-to-id-in-controller-method-in-mvc


Setup VNC on Ubuntu 20.04

  sudo apt update sudo apt install xfce4 xfce4-goodies sudo apt install tigervnc-standalone-server sudo apt install tightvncserver vncserver...