Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 84751

Why is the controller being repeatedly called?

$
0
0

I set a break point in the constructor of my controller and I noticed that the controller is getting called several times on the startup of my project.

In my _Layout I have a menu control setup like:

 @(Html.Kendo().Menu()

            .Name("myMenu")
            .Animation(a =>
            {
                a.Open(o =>
                {
                    o.Expand(ExpandDirection.Vertical);
                    o.SlideIn(SlideDirection.Down);
                    o.Fade(FadeDirection.In);
                });
            })
            .HoverDelay(100)
            .Items(i =>
            {
                i.Add().Text("Job Profiles")
                    .Items(child =>
                    {
                        child.Add().Text("Item 1").Action("Act1", "Home");
                        child.Add().Text("Item 2").Action("Act2", "Home");
                        child.Add().Text("Item 3").Action("Act3", "Home");                        
                        child.Add().Text("Item 4").Action("Act4", "BadController");

                        child.Add().Text("Item 5").Action("BadAction", "Home");
                    });
            })
        )

 

 

So in my Home Controller I will see it being called 4 times.

Why does this happen?  It's not like it's validating the action/controller at this time, because Item 4 and Item 5 should blow up. (It will blow up, but only when the user clicks on the items).

This is causing poor performance due to initialization that I have occurring in the constructor.

 

Please advise.


Viewing all articles
Browse latest Browse all 84751

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>