Correct Route Patterns in MVC4

I Have a calendar at My event query string looks like But users can select the events by year and months using drop down lists, so mu query becomes or even So the problem is when I click the I got How to arrange my routes to make them understand what I need to show: list or event?


well I would add a custom route like this:

    "NewRoute", // Route name
    "{controller}/{action}/{id}/{another_id}", // URL with parameters
    new { controller = "Events", action = "Calendar", id = UrlParameter.Optional, another_id = UrlParameter.Optional } // Parameter defaults

Your controller would then have an action method like this:

public ActionResult MyAction(string id, string another_id)
    // in the question you mentioned that a a valid list querystring would contain
// multiple integer parameters, and an event querystring would include a 
//seo friendly string
    int para;
     if (int.TryParse(id,out para))
        // show list view
        //show event view

you just need to recieve the parameters and run some kind of check to determine if you are going to show an event or a list.

Need Your Help

Add padding to hex string for remaining bytes

php hex

I never ever worked with Hex-strings in PHP (or whatever language). Now I'm wondering how I could add padding to a hex string with 00 (in hex) up until it reaches 8 bytes.