Unplanned
Last Updated: 31 Jan 2020 15:25 by ADMIN

When using .BindToLocation(true) it would be great if the developer had either a .Skip(string) or .Skip(string array) (or .Exclude(string) or .Exclude(string array).

This is useful because in ASP.NET Core when using Razor Pages, the site can be organized into Folders.  That Folder structure shows up in the URL even though there might not be an equivalent page.

As an Example, I have the following folder structure:

Pages --> Alerts --> AlertAvailableUnits 

The resulting URL in ASP.NET Core is:

https://localhost:44313/Alerts/AlertAvailableUnits 

Now, let's say I have the following Breadcrumb definition:

@(Html.Kendo().Breadcrumb()
.Name("breadcrumb")
.BindToLocation(true)
.Navigational(true))

This results in the following Breadcrumb:

Home > Alerts > AlertAvailableUnits

 

However...if I had an Exclude or Skip function then I could create the following definition:

@(Html.Kendo().Breadcrumb()
.Name("breadcrumb")
.BindToLocation(true)
.Navigational(true)
.Skip("Alerts"))

// OR As a String Array

@(Html.Kendo().Breadcrumb()
.Name("breadcrumb")
.BindToLocation(true)
.Navigational(true)
.Exclude(["Alerts"])

This would result in the following Breadcrumb:

Home > AlertAvailableUnits

 

This is what I'm after.  Since BindingToLocation has to parse the URL anyway to produce the Breadcrumb, then the Developer should have a way to Exclude or tell it to ignore/skip a part of the URL.

This would be complementary to my previously requested Breadcrumb Feature .IgnoreLastXSegments(integer).

The difference between the two is -- in the .Exclude/Skip case the segment I want to ignore is Known and occurs (usually) in the middle of the URL.  In the IgnoreLastXSegments, the URL contains parameters that always show up at the end.

Implementing these Features would make the BindingToLocation feature much more useful and promotes code reuse.  It is also a much simpler implementation than defining Items which does not promote code reuse.

Thanks for your consideration.