Ah, so that’s how to preserve code formatting in WordPress…

So my post for today…I finally figured out how to get the formatting right for when I post code snippets. Here’s a link to where I found the info about how to do it.

Posting Source Code in WordPress

Below is an example of some code I wrote from a previous post. I switched to the HTML tab and created the special tags needed to specify a code block, then cut and pasted they code right out of Visual Studio to here.

public object ProvideValue(CustomPropertyInfo customPropertyInfo, object context)
{
    RadGridView gridView = context as RadGridView;

    switch (customPropertyInfo.Name)
    {
        case "Columns":
            {
                List<ColumnProxy> columnProxies = new List<ColumnProxy>();

                foreach (GridViewColumn column in gridView.Columns)
                {
                    columnProxies.Add(new ColumnProxy()
                    {
                        UniqueName = column.UniqueName,
                        Header = column.Header.ToString(),
                        DisplayOrder = column.DisplayIndex,
                        Width = column.Width,
                    });
                }

                return columnProxies;
            }
    }

    return null;
}

Hope this helps someone…Enjoy. 🙂

Advertisements
Ah, so that’s how to preserve code formatting in WordPress…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s