Microsoft Most Valuable Professional

Chris Pietschmann

An MVP From Wisconsin

ASP.NET: Add Template Support to your User Controls

Here's a great article on how to add support for Templates to your ASP.NET User Controls.

http://msdn2.microsoft.com/en-us/library/36574bf6.aspx

 

Updated 8/17/2007: I changed the link above since the old one I had posted is no longer there.

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:
Categories: General
Posted by crpietschmann on Thursday, September 28, 2006 11:12 AM
Permalink | Comments (0) | Post RSSRSS comment feed


Building a "successful" blog...

Yes, I know there are tons of posts on other blogs that describe how to create a "successful" blog. Since, I've been bloging for over two years now, I thought I'd share some things that I've learned.

Below, in the order they came to mind, are some tips for building a successful blog:

  • Make sure you have an RSS feed. This one is crucial, otherwise how would people subscribe?
  • Pick a main theme to center your blog posts around. For instance my blog centers around .NET and web development.
  • You can stray from your main theme but try to keep it to a minimum. You don't want to loose your readers interest and make them unsubscribe.
  • Use as many keywords as you can in your blog post title and content. This will help you show up in search engines.
  • Place the Title of you blog post (not your blog) in the page title when displaying a single post. This will help you show up in search engines.
  • Don't require visitors to login in order to post comments. You want to encourage comments as much as possible.
  • Use banner ads tastefully but make sure they are visible so visitors click on them. Don't take up too much page real estate or make them annoying.
  • Buy a domain name to host your blog at so you have control over everything and this will help with search engines. Try to find a domain name that is related to what you'll blog about.
  • Don't be afraid to link to other blog posts or sites.
  • When you post comments on other blogs make sure you enter in the url to your blog. This is an easy way to get links to your site.
  • Setup your blog url as your blog/website url or signature on forums you participate. This is another way to easily get links to your site.
  • Try to find things to blog about that others aren't blogging about as much. Fill in a gap. This will help you come up higher in search engines since your post might be one of only a few about that particular item.
  • Make sure you have a contact form on your site so visitors can email you.
  • Always try to reply to any comments/questions that your visitors/subscribers send you.
  • Post regularly but not too often. If you don't post enough visitors wont subscribe and if you post to often visitors wont read all your posts.

How do you know your blog is "successful"? Well, for one the fact that you can actually maintain a few subscribed readers.

Why do I think my blog is "successful"? Well, maybe I think higher of my blog than it actually is, but what I'm doing seems to be working.

Here's a list of some cool features that I've seen on other blogs or have thought about adding to my own:

  • An OPML feed of your Blog Roll. This allows your visitors to easily import your blog roll into their favorite RSS reader. (this one I currently have implemented)
  • Add the ability for visitors/subscribers to rate/rank your posts. This will allow you to know if they're satisfied with your content.
  • Use Tagging to categorize your posts.
  • Add a view count to your posts so you can see which ones visitors are looking at.
  • Add a "Recently Viewed" list so visitors can see what posts other visitors are viewing.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: General
Posted by crpietschmann on Friday, September 22, 2006 3:13 PM
Permalink | Comments (0) | Post RSSRSS comment feed


ASP.NET: Extend BoundField Control - Add MultiLine support

I've been working with the data controls and it's somewhat cumbersome to use a TemplateField control everytime you want to just have a MultiLine TextBox. So, I decided to extend upon the BoundField control to add MultiLine support. It is actually rather simple to do.

Using the BoundTextBoxField control in the page:

<%@ Register Namespace="CustomBoundField" TagPrefix="custom" %>

<asp:GridView ID="GridView1" runat="server">
<Columns>
<custom:BoundTextBoxField DataField="Text" HeaderText="MultiLine Text" SortExpression="Text" TextMode="MultiLine" Rows="5" Columns="25" Wrap="True" />
</Columns>
</asp:GridView>

Code for the BoundTextBoxField control (~/App_Code/BoundTextBoxField.cs):

using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace CustomBoundField
{

/// <summary>
/// Summary description for BoundTextBoxField
/// </summary>
public class BoundTextBoxField : System.Web.UI.WebControls.BoundField
{

public TextBoxMode TextMode
{
   get
   {
      TextBoxMode _tm = TextBoxMode.SingleLine;
      if (this.ViewState["TextMode"] != null)
         _tm = (
TextBoxMode)this.ViewState["TextMode"];
      return _tm;
   }
   set { this.ViewState["TextMode"] = value; }
}

public int Columns
{
   get
   {
      int i = 0;
      if (this.ViewState["Columns"] != null)
         i = (
int)this.ViewState["Columns"];
      return i;
   }
   set { this.ViewState["Columns"] = value; }
}

public int Rows
{
   get
   {
      int i = 0;
      if (this.ViewState["Rows"] != null)
         i = (
int)this.ViewState["Rows"];
      return i;
   }
   set { this.ViewState["Rows"] = value; }
}

public bool Wrap
{
   get
   {
      bool b = true;
      if (this.ViewState["Wrap"] != null)
         b = (
bool)this.ViewState["Wrap"];
      return b;
   }
   set { this.ViewState["Wrap"] = value; }
}

protected override void OnDataBindField(object sender, EventArgs e)
{
   base.OnDataBindField(sender, e);
   Control c = (Control)sender;
   if (c is TextBox)
   {
      TextBox txt = (TextBox)c;
      txt.TextMode =
this.TextMode;
      txt.Columns =
this.Columns;
      txt.Rows =
this.Rows;
      txt.Wrap =
this.Wrap;
   }
}

}

}

Currently rated 3.0 by 1 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:
Categories: General
Posted by crpietschmann on Wednesday, September 20, 2006 12:18 AM
Permalink | Comments (11) | Post RSSRSS comment feed


Polymorphic Podcast: Awesome .NET Podcast!

I've searched for quality development related (specifically .NET) podcasts, and there really aren't very many. The Polymorphic Podcast is an awesome .NET podcast with some really great content. I really recommend checking it out.

Listen: Polymorphic Podcast

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:
Categories: General
Posted by crpietschmann on Thursday, September 14, 2006 11:38 AM
Permalink | Comments (0) | Post RSSRSS comment feed

About the author

I'm Chris Pietschmann, go to the About Me page to learn more about me.

Search

Sponsors

Web.Maps.VE - ASP.NET AJAX Virtual Earth Mapping Server Control

Recent comments

Disclaimer


This work is licensed under a Creative Commons Attribution 3.0 United States License, unless explicitly stated otherwise within the posted content.
© Copyright 2004 - 2008 Chris Pietschmann