Tag

asp.net Archives - Falafel Software Blog

On Sitefinity Custom Widget Caching

By | .NET, ASP.NET, C#, MVC, Sitefinity | No Comments

Sitefinity is Caching too Hard! If you’ve done software development for any length of time, you’ve likely run into a caching issue. Caching is difficult to get right, but it is so beneficial that we work with it in nearly everything we do. In the case of Sitefinity, it performs caching all over the place. As a result, many aspects of the Sitefinity experience are greatly improved. If you disabled caching for a Sitefinity site altogether, the site would slow down immensely. Sitefinity, by its nature of being a Content Management System, stores the bulk of its content in the…

Read More

Dynamic Content Detail Widget Templates in Sitefinity

By | .NET, ASP.NET, C#, Sitefinity | No Comments

Getting to Dynamic Content Data in Custom Code Behind In a previous post, I went over how you can easily create a custom code-behind C# class for any Widget Template in Sitefinity. Give that post a quick once-over, as this post builds upon that one. For built-in Sitefinity content items, accessing the data is pretty straightforward (see the previously-linked post): You grab the container, iterate over the items (even in the case of a single detail item), and then work with the data to make customizations to the page. For Dynamic Content Detail Widget templates, however, things work differently. You…

Read More

ConfigSource Your Rewrite Rules

By | .NET, ASP.NET, Web | 2 Comments

When your Web.Config Gets too Big Maintaining a web.config in your ASP.NET application can quickly get out of hand. It contains the bulk of your web application’s settings and configurations, and even the fresh, out-of-the-box version is several hundred lines long. If you have a set of IIS URL Rewrite Rules to maintain in the same file, the web.config can become immense. This is where using configsource can come in handy. Benefits of ConfigSource In my view there are some large advantages to separating your list of rewrite rules out from the web.config file into a separate, configsource-appointed config file….

Read More
asp-net-core-area-index-view

MVC Areas with ASP.NET Core

By | ASP.NET, ASP.NET Core, MVC, Web | One Comment

Areas in MVC allow you to separate your web application into segments, each with their own set of Controllers and Views, for better organization and intuitive access via routing. I decided to play with this MVC Areas feature in ASP.NET Core and thought I’d share my experience in case it might help others using this feature. My first attempt to use this was to simply add the Areas folder to the root of my application, with a subfolder called Admin with the associated folders for Controllers, Models, and Views: I added a simple AdminController to simulate a separate Administration section…

Read More

Web API Route Design for Non-CRUD Routes

By | ASP.NET, Web API | 2 Comments

Introduction I’ve been finding myself thinking a lot about route design for the web APIs I’ve been building lately. For your basic CRUD (Create, Read, Update, Delete) controllers, everyone knows that the POST HTTP verb maps to create/insert; GET maps to read/select; PUT maps to update; and DELETE maps to–brace yourself–delete. But what about routes that represent things beyond these fundamental but basic data manipulations? I’ve done a bit of reading and thinking about the subject, and these are a distillation of the lessons I’ve learned. URLs represent resources I mean, it’s right in the name: Uniform Resource Locator. But what…

Read More

QuerySelectorAll Error on BeginFormSitefinity

By | ASP.NET, MVC, Sitefinity | No Comments

When developing a custom form on Sitefinity MVC widgets, the HTML helper method Sitefinity provides, Html.BeginFormSitefinity(), is a very handy resource. You wrap your form elements up inside the whole thing, along with a submit button, and you can point it at an HttpPost Action on your custom MVC widget controller with ease. When you’re putting your form widget on a master page, however, you can run into a rather vague JavaScript error that prevents your form from submitting correctly. The error in JavaScript brings up something about querySelectorAll and you’re left scratching your head as to what you did…

Read More

Widget Template Code Customized the Easy Way

By | .NET, ASP.NET, C#, Sitefinity | One Comment

Sitefinity’s Widget Templates provide a quick and easy way to change how Sitefinity renders widgets, both for built-in content types as well as custom ones. In the backend, it’s just a hop, skip, and a jump away to Design > Widget Templates to access a majority of the templates where you can manipulate the HTML used to render them. Oftentimes, though, you have to do more. Let’s say that, when iterating over a list of news items in the “Titles only” template you want to add a CSS class to some of the items, but not others. This goes beyond…

Read More

How to Upload Files to your Sitefinity Document Library Asynchronously

By | .NET, ASP.NET, C#, JavaScript, Sitefinity, Web API | 2 Comments

Sometimes, it is necessary for users of your site to be able to upload files to Document Libraries in an asynchronous manner. They could be creating user-generated content and require a space to upload a file to reference in their content, for instance. Using some JavaScript and an ASP.NET WebAPI controller, we can accomplish this fairly simply. The HTML The first thing we’ll need is an input that allows users to select a file. This’ll be a simple HTML input the “file” type. You can put this HTML (along with the associated JavaScript) anywhere on the page, either via Content…

Read More
AngularJS

The Best Developer Articles of 2014

By | AngularJS, ASP.NET, Kendo UI, Telerik | 2 Comments

It’s a new year, sure, but we we’re not quite ready to give up our most popular articles of 2014. From simple tips to deep dives into code, these posts have it all! AngularJS and Kendo UI – Part 1 – Getting Started We’re bringing together two themes I’ve been developing for the past few months: AngularJS and Kendo UI. These technologies go together like peanut butter and chocolate, and both share two characteristics that are critical to this series: The technology is hot, desirable and useful The reference documentation is very good, but good tutorials are in short supply…

Read More

It Takes a Lot of Chutzpah to Run QUnit and Jamsine Unit Tests in Visual Studio

By | ASP.NET, JavaScript, News, Testing, Tools, Web | One Comment

It’s never easy to unit test your code well, but to unit test your JavaScript code in Visual Studio takes Chutzpah. And I don’t mean it takes audacity in the classic Yiddish sense of the word, either. I mean it requires a Visual Studio extension called Chutzpah which can help you automate running your Jasmine, QUnit, or Mocha unit tests for your ASP.NET projects in Visual Studio. Chutzpah supports the two most recent versions of Visual Studio–VS 2012 and VS 2013–and it works with all types of ASP.NET projects. It’s really very simple to install. You can use the Extensions and Updates… option from the Tools…

Read More

Loading JavaScript and CSS Resources from Nested ASP.NET Partial Views

By | .NET, ASP.NET, News, Web | One Comment

The Problem When ASP.NET v4 was released, a cool feature from the beta was lost: the AssetsHelper class. Brock Allen has a great blog post explaining it and noting that it doesn’t exist in the RTM version. Basically, this helper class would allow you to emit some scripts and stylesheets from a partial view and have them bubble all the way up the tree of view elements to the layout where they would be displayed with all the other js and css files emitted by other parts of the view. For example, this partial view can render to assets:

And those assets can be…

Read More

Add Namespaces to Sitefinity RSS Feed

By | .NET, C#, Sitefinity, Web | No Comments

Alternative Publishing is a useful feature of Sitefinity. I’ve been using it since a long time but recently I had a situation where I needed to add Dublin Core Metadata Element Set elements like and . So I tried to figure out how to include http://purl.org/dc/elements/1.1/ namespace in the feed Sitefinity generates, and here’s the solution. When you override RSSOutboundPipe class, override BuildSyndicationFeed method to add namespaces.

Read More

Server Paging, Sorting, and Filtering with Kendo DataSourceRequest

By | ASP.NET, C#, Kendo UI, MVC, Telerik, Web | 12 Comments

As you would expect, the Kendo UI Grid and DataSource work extremely well together and give you paging, sorting, and filtering right out of the box.  By default, the DataSource will do all of this on the client which is fine for small sets of data, but it becomes a huge performance issue when you are dealing with thousands of records.  In this case, we need to move this work to the server. I typically do not endorse using the Kendo MVC Extensions for large applications (you get more flexibility and a cleaner architecture when you write your own Javascript),…

Read More

HTTP GET array param to ASP.NET MVC with Kendo DataSource

By | .NET, ASP.NET, JavaScript, Kendo UI, MVC | No Comments

This post is inspired by a recent conversation with one of my colleagues here. He had the following requirements: ASP.NET MVC controller (not Web API) Kendo DataSource reading with HTTP GET Controller action accepts a list of values So, something like this:

This is an awkward little corner case. Change any one of the requirements and everything will work just fine. Fresh out of the box, Web API understands sending multiple values in the query string (at least, with the right controller action method signature). MVC controllers understand arrays if they’re posted in the body of the request,…

Read More

Domain-Driven Design with ASP.NET MVC

By | Uncategorized | 2 Comments

I’ll be speaking on about Domain-Driven Design, or DDD, with ASP.NET MVC at this year’s FalafelCON event, taking place 20-21 September 2014 in San Francisco.  The event is limited to the first 200 people to register, so if you’re interested in attending, you may want to register today.  DDD is a big topic, and one I’ve been interested in for many years now.  In fact, I recently published a course on DDD Fundamentals with Julie Lerman for Pluralsight that covers the basics.  If you have a chance to watch it, let me know what you think via the course’s discussion…

Read More

Sitefinity Real-Time Notifications with SignalR

By | Sitefinity | No Comments

One of the more interesting technologies I discovered during my recent trip to Tech Ed 2014 is SignalR, which is a library for ASP.NET that allows real-time communication between the server and browser. This exciting platform enables bi-directional communication between a page and the server, allowing updates to be instantly pushed in either direction. Best of all, SignalR automatically detects the best option for communication based on the capabilities of the client ensuring maximum compatibility across different browsers.

Today we’ll see how you can setup Sitefinity to use this library with a simple notification that fires when a user logs into the backend. Later we’ll build a more real-world scenario by building a real-time viewer count for a blog post.

Read More