As I posted about earlier I was made aware of a feature from FeedBurner that allows you to get my post via email. I wanted to add a side bar item to make it easy for folks, but the supplied code from FeedBurner wouldn't work in ASP.NET. So I had to make a few changes to how it works.
First I had to add the item to the left bar. Pretty easy, here is my HTML... yours could be different based on your theme. This is in my site.master file in my theme directory.
<h2>Get Post via Email</h2>
<ul>
<li>
<asp:TextBox ID="txtFBEmail" runat="server" Width="115px" Height="17px" ></asp:TextBox>
<asp:Button ID="submit" runat="server" Text="Subscribe" OnClick="submit_Click" Width="75px" />
</li>
</ul>
Then I had to go to the code behind and add a function to it. Here is my code, please note the three areas where you need to put your own feedburner information in the URL. I have also edited my code slightly to post correctly on this blog.
protected void submit_Click(object sender, EventArgs e)
{
//This is where I create the CSM
ClientScriptManager csm = Page.ClientScript;
//This is the money code... this is what makes it work.
csm.RegisterClientScriptBlock(this.GetType(), "OpenWin",
"window.open('http://www.feedburner.com/fb/a/" +
"emailverifySubmit?feedId=YOUR_FEED_ID&email=" +
txtFBEmail.Text + "&url=http://feeds.feedburner." +
"com/~e?ffid=YOUR_FEED_ID&title=" +
"YOUR_BLOG_NAME&loc=en_US', 'popupwindow', " +
"'scrollbars=yes,width=550,height=520')", true);
//This is just clearing the text box.
txtFBEmail.Text = "";
}
Now I know there is another way to do this via JavaScript and Client click, but I did this late at night and just wanted something that worked. Hope it helps you! And if you're not using FeedBurner... do IT!