All Things Tagged 'Snippet'

Customize ASP.NET Wizard SideBar Template [Snippet]

If you have used the ASP.NET Wizard Control and have tried to use the default Sidebar template, you know that it does not allow you to get rid of the LinkButton controls. Learn about how to customize the sidebar template to your needs.

Use PHP to Grab Event Date from Google Calendar RSS

Recently I finished a site that required me to use Google Calendar to manage events. I thought that it would be nice to show what events are up and coming, so I used SimplePie to grab and show their calendar feed.

Read RSS/Atom Feed Using .NET and the XmlDataSource With Or Without Namespaces [Coding]

Today I was working on my site and I wanted to show some recent blog entries on the side. Used to PHP I was looking for an RSS reader I could use. I found one but it didn't quite work with what I needed.

Fix: Suckerfish IE7 Disappear/Sticky Bug

After searching Google and reading comments, I could not find a solution to a problem I had while using the Sons of Suckerfish drop-down menu. My problem was not only that the drop down stuck when you clicked somewhere first, but also the drop down would disappear when I got past a certain point (probably the height of the containing <li>).

Function to Generate a Slug (URL-friendly String) [Helpers] [Updated]

Update #1: With the help of my esteemed colleague Zach, I've provided a PHP function as well and fixed some bugs with the .NET version.

PHP String Format Function [Helpers]

In .NET we have a great little function called String.Format that will transform a string and format it. Here's a PHP function that will substitute strings in the same fashion.

Function That Resizes Dimensions to Bounds [Helpers]

In one of my current projects at work I needed to load photos off the file system and resize them so that they fit within a specified set of bounds. So, obviously, I created a function to calculate it for me!

Function That Generates a Page Title Based Off Web.Sitemap [Helpers]

On the Intrepid Studios site, we use a web.sitemap file to keep a list of the static pages on the site. It's becoming more common in web design to have a page title that is a reverse-breadcrumb. Learn how to do it for your own site using a helpful function.

Putting DynamicFields in a Validation Group [Dynamic Data]

If you're like me, you've implemented Dynamic Data with master-detail pages that include GridView controls and perhaps multiple drill-down DetailsView controls or other form controls.

You also proceeded to realize that validating two or more controls on the same page with DynamicFields is hard, to the say the least. Luckily, I found a streamlined solution!

Simple ToolTips for ListBox Controls [Windows Forms]

I am working on a project right now and I list values in a ListBox, but the text gets cut off when a value is really long. I looked around and while I found custom controls and such, I didn't need anything fancy. Here is a quick fix I found on MSDN.

RegEx: Get the array of values for a SET/ENUM in MySQL [Snippet]

Need a fast and easy way to generate an array of the different values for a SET or ENUM data type in MySQL? I'll show you how in two lines of code.

Get the First Paragraph of Text of a String [Helpers]

This is a simple PHP function (that can easily be replicated in .NET) that will take a string and get the first paragraph of text it can find. Works with HTML and plain text. Hit the jump for the code.

Easily Select Controls Using Complex Expressions [Sizzle]

If you've used jQuery before, you know you want that kind of amazing selector functionality for .NET. The good news is that you can get that kind of complex selecting using a free code snippet called Ra.Selector. It supports finding controls by type according to a predicate (boolean expression) and also recursively finding a control by ID.

How To: Use a ListView to Make People Read a Statement Before Filling Out Your Form

I use a ListView to display a form based off of a data model that people fill out. I know that ListViews are meant for lists but I like that you can databind it to a source so you don't have to do any code behind. In my case, I just need values from a custom control within the ListView.

Maintaining Checked State On Radio/Checkbox Controls On Post Back

I had a unique problem today. Here's the scenario: You have a ListView that dynamically loads different ItemTemplates depending on a specific criteria (in my case, a category). You load this user control template into the ItemTemplate and create some radio and checkbox buttons. If you set GroupName on the controls to a group name, .NET will not associate all the different buttons across the templates because they have different naming containers.

Power Tip: Convert a string to an array of Integers

Here are two extension methods that can convert a string (delimited by anything of your choosing) into an array of integers. Successfully handles any non-Integer data smoothly as well.

Making UrlRewritingNet Ignore URLs [Fix]

I recently updated the Intrepid Studios site back-end to include ELMAH, the error reporting module. ELMAH is great and works great, except that it doesn't play nice with UrlRewritingNet.

A C# PrettyJson Extension Method [Gist]

I wrote this for my .JSON module:

An error has occured while trying to process your request. Hide