Johnny Code
Fear no code
Browse: Home / ASP.NET

ASP.NET

ASP.NET MVC Extension Method for the ID in the Route

By John Bubriski on November 9, 2011

If you’ve worked on an ASP.NET MVC site, you may have had to reference the ID in the current route.  In a Razor view you can reference it via the following variable: @Url.ViewContext.RouteData.Values["id"] You may use this a lot if you have a lot of inter-action navigation. Why not throw it into an extension method!? [...]

Posted in Programming | Tagged .NET Framework, ASP.NET, ASP.NET MVC, C#, Code, Extension Method | Leave a response

Custom Validation with BizForms

By John Bubriski on October 17, 2011

Ever need to inject some custom validation into a BizForm?  Check it: Below I’ve provided a method you can drop into your BizForm code behind, or the code behind of a BizForm clone.  Then, call this method from an event handle for the OnBeforeValidate event.  If Field A has a value this validation method forces [...]

Posted in Kentico, Programming | Tagged .NET Framework, ASP.NET, C#, Code, Kentico API Programming, Kentico BizForms, Kentico CMS | Leave a response

Can’t reinstall IIS issue

By John Bubriski on September 5, 2011

I ran into this fun issue the other day where I I couldn’t access one of my sites. I assumed it was a problem with ASP.NET so I uninstalled it. To my dismay, the reinstall failed! That has never happened before! The problem was actually a simple one. I had moved one of the many [...]

Posted in Uncategorized | Tagged ASP.NET, IIS | Leave a response

Cloning the existing BizForm webpart

Creating User Specific, Editable BizForms

By John Bubriski on April 19, 2011

In this article I’ll show you how to create a special type of BizForm that will allow each user to edit their specific form data over and over. When a user returns to a page that has the BizForm on it, their data will be automatically loaded from the BizForm table. This is a simple and easy way to store per user data, without mucking with the System Tables which aren’t intended to store this type of data. You also retain the benefits that a BizForm has over a System Table (A view of the data, Notifications, attachments, etc.)[...]

Posted in Kentico, Programming | Tagged .NET Framework, ASP.NET, C#, Code, Kentico API Programming, Kentico BizForms, Kentico CMS | 3 Responses

How To Render An ASP.NET Control To A String

By John Bubriski on March 31, 2011

A simple code snippet. I like to use “using” statements to make sure the various resources get cleaned up in a timely fashion [...]

Posted in Programming | Tagged ASP.NET, HtmlTextWriter, RenderControl, StringWriter, Web Control | 2 Responses

Kentico Custom Form Control: Required Checkbox

By John Bubriski on December 3, 2010

Kentico is great but nobody is perfect!  One small detail they’ve missed is a checkbox control that you can set to be “required”.  By required I mean “You have to check this box”.  After doing some Googling, I found this thread which confirmed my suspicion: http://devnet.kentico.com/Forums/f45/t17269/Making-a-Required-CheckBox-in-Alternative-Form.aspx?replyto=17359 “We have validators for empty values, which means that [...]

Posted in Kentico, Programming | Tagged .NET Framework, ASP.NET, C#, Code, Kentico API Programming, Kentico CMS | 2 Responses

How to correctly use a Try/Catch block in C#

By John Bubriski on October 25, 2010

If you ever do something like this… try { // Some potentially dangerous code } catch (Exception ex) { // Do nothing and swallow the exception } …DON’T. There is never a good reason to do this! If you have this code in a Class Library the problem is magnified! Doing this makes it hard [...]

Posted in Programming | Tagged .NET Framework, ASP.NET, C#, Code, Elmah, Exceptions, Kentico API Programming, Try/Catch | 1 Response

Some useful Visual Studio code snippets

By John Bubriski on October 18, 2010

So recently I’ve created a couple useful code snippets, and here they are for you to download! Download My Code Snippets To use them, just place them in your custom code snippets directory, which will be something like: C:\Users\{username}\Documents\Visual Studio 2010\Code Snippets Here are the snippets that are included in the zip file download: C# [...]

Posted in Programming | Tagged .NET Framework, ASP.NET, C#, Code, Code Snippet, jquery, SQL, Visual Studio | Leave a response

Setting up a New Email Template

Using Kentico’s Email Templates in Custom Code

By John Bubriski on July 18, 2010

Kentico has an email template feature that is used in many areas of the CMS. When a user registers, posts to the forum, or places an order in the E-Commerce system, they are sent an email from a predefined template that has been filled with their information. I’ll show you how easy it is to leverage this feature in your own code.

Posted in Kentico, Programming | Tagged .NET Framework, ASP.NET, C#, Code, Email Templates, Kentico API Programming | 5 Responses

Adding Macro Expression support to Kentico Web Parts

By John Bubriski on July 16, 2010

A coworker of mine had a BizForm in Kentico that needed a dynamic URL Redirection after the form was submitted. Based on the page with the BizForm, the user would be redirected to a different thank you page. There are many reasons you could want dynamic thank you pages for a single form. For starters, it’s a lot easier to manage one set of data. Then there are the SEO benefits of having separate thank you pages. Don’t forget you might simply want different content, or another page/template entirely!

Posted in Kentico, Programming | Tagged .NET Framework, ASP.NET, C#, Code, Kentico API Programming, Kentico Macro Expressions | 2 Responses

Next »

About Me

I'm a Software Engineer at Worcester Envelope in Auburn, MA. Check out the About page to learn more about me.
Follow @JohnBubriski

Pages

  • About Me
  • Contact Me
  • Developer Resources
  • Kentico Resources
    • Kentico Tips and Tricks
    • Settings Module for Kentico CMS

What I’m Reading

  • The Quick Python Book, Second Edition
  • ASP.NET MVC 2 in Action
  • The Art of Unit Testing: With Examples in .Net
  • Code Complete: A Practical Handbook of Software Construction

My Recent Tweets

  • @mattrgrs I haven't used it, but the demos looked promising. @KenticoCMS is still my favorite #CMS over any of the other options. 6 hours ago
  • '#Programming .Net #Security' by Adam Freeman should be required reading for anyone attempting #Encryption in #DotNet: http://t.co/m0iU37qE 8 hours ago
  • @scottadhoc Godspeed! 12 hours ago
  • @mattrgrs You mean Orchard? 12 hours ago
  • @scottadhoc Is that like a diet, but with pie? 12 hours ago

Tags

.NET Framework ASP.NET AspDotNetStoreFront batch blogging C# Code Code Camp Data Binding delete entity-framework Exceptions Extension Method HTML IIS iTextSharp javascript jquery Kentico API Programming Kentico BizForms Kentico CMS Learning Python 3 Microsoft Open Office pdf PHP plugins Productivity Property Quick Tip random Return Values Shortcuts SQLite Development Strings Syntax Highlighting template Time Saver Travian Add On Project URL Routing Using PyGame Visual Studio web-service Windows wordpress

Archives

  • 2012 (1)
  • 2011 (12)
  • 2010 (19)
  • 2009 (12)

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

Copyright © 2012 Johnny Code.

Powered by WordPress and Hybrid.

Maintained by John Bubriski