|
Who Are We?Fluent Consulting is a software development and consulting firm that specializes in enterprise application integration, web applications, and software product development. We are a dedicated team focused on providing the highest level of quality and value for our clients. Please feel free to visit our corporate site or get in touch! |
Bi-directional Data Binding for ASP.NET 1.0/1.1
There's only so much casting, converting, parsing that one can take trying to push and pull data from custom objects into form controls. Although, ASP.NET 2.0 has improved the situation, there's another simple model to package up some of this common code into a reusable component. Continue reading "Bi-directional Data Binding for ASP.NET 1.0/1.1"IIS Nested Virtual Directory Problems
Microsoft Internet Information Server (IIS) 5.1 has an undocumented bug we recently came across. The bug involves nested virtual directories in IIS. We encountered the bug on a development machine running Windows XP Professional (with IIS 5.1), but it may also exist on servers running IIS 6.0. The fix is easy, once you know what is going on.
The quick fix is to not include a period (.) in the name of a nested virtual directory. For some reason a period prevents nested virtual directories from loading properly. With a period in the name, the nested virtual directory is instead treated as just a directory by IIS. Your files are available, but they tie back to the parent bin rather than the nested bin.
Continue reading "IIS Nested Virtual Directory Problems"infORM Beta Release
Inform is an Object Relational Mapper for .Net with a focus on rapid development, an extendable architecture, and support for run-time creation of data storage. find out more
Creating Templated Emails
Often we need to generate email responses from our ASP.NET applications. Users forget their passwords, need email confirmations, or we'd just like to send them a friendly thank you for signing up.
Now you could create that email message with a nice series of string concatenations, or some fancy xml/xslt transformation. But who needs that when there is an easier way using what's available from our aspx parser?
First thing to create is a typical user control. This will be your template.
ForgotPasswordEmail.ascx<%@ Control Language="c#" AutoEventWireup="false" Codebehind="ForgotPasswordEmail.ascx.cs" Inherits="EmailTemplateExample.ForgotPasswordEmail" %> Here is your password reminder. ----------------------------------- YOUR ACCOUNT INFORMATION: Login: <%= Username %> Password: <%= Password %> ----------------------------------- TO CHANGE YOUR ACCOUNT INFORMATION: You can change your account information by logging in and selecting 'Account Information'. This is an automated message; please do not reply to this email.ForgotPasswordEmail.ascx.cs
namespace EmailTemplateExample { public abstract class ForgotPasswordEmail : System.Web.UI.UserControl { public string Username; public string Password; } }Once you have created the template, using it only takes a few lines of code.
using System; using System.IO; using System.Web.UI; using System.Web.Mail; ... //Load the user control ForgotPasswordEmail emailTemplate = (ForgotPasswordEmail)LoadControl("~/ForgotPasswordEmail.ascx"); emailTemplate.Username = "jroberts"; emailTemplate.Password = "a7e945"; //Render the user control to a string StringWriter stringWriter = new StringWriter(); HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter); emailTemplate.RenderControl(htmlWriter); string body = stringWriter.ToString(); //Send the email SmtpMail.SmtpServer = "localhost"; SmtpMail.Send("system@localhost","jroberts@localhost", "Password Reminder", body);Your template could have more complex behavior, having the full power of the ASP.NET user control model. Additionally, using html in your user control to create html emails only requires properly setting the format of the MailMessage.
//Prepare HTML email MailMessage mailMessage = new MailMessage(); mailMessage.From = "system@localhost"; mailMessage.Subject = "Password Reminder"; mailMessage.BodyFormat = MailFormat.Html; mailMessage.UrlContentBase = "http://localhost/"; //Send the email SmtpMail.SmtpServer = "localhost"; SmtpMail.Send(mailMessage);
MultiLineTextBoxValidator component released
Fluent.MultiLineTextBoxValidator is a validator control which will restrict the length of MultiLine TextBox controls. The MaxLength property of the .NET TextBox control does not have any effect if the TextMode property is set to MultiLine. This is because MultiLine TextBox controls are rendered in HTML as TEXTAREA tags, which cannot have a restricted length. This control adds Javascript support to achieve the length restriction. In addition it can provide feedback of the number of characters remaining before the MaxLength cutoff will be reached. Demo and download now!<%@ Register TagPrefix="fluent" Namespace="Fluent.MultiLineTextBoxValidator" Assembly="Fluent.MultiLineTextBoxValidator" %> Message:<br/> <asp:TextBox id="TestTextBox" Runat="server" Rows="10" Columns="50" TextMode="MultiLine" /> <br/> <fluent:MultiLineTextBoxValidator Runat="server" ControlToValidate="TestTextBox" MaxLength="10" OutputControl="TestTextBox2" ErrorMessage="Too long!" ShowJavascriptAlert="True" EnableClientSideRestriction="True" ShowCharacterCount="True" /> <br/><br/> <asp:TextBox id="TestTextBox2" Runat="server" /> characters remaining <br/><br/><br/> <asp:Button Runat="server" Text="Submit" />
ListTransfer Component Released
The ListTransfer Control simplifies the transfer of ListItems and is useful in the creation of double or mutliple listbox controls. With this component you can lay out your typical ListControls such as the ListBox, then just drag on the ListTransfer Control and wire it up. More details.<script runat="server"> void AddEmployees(object sender, EventArgs args){ ListTransferEmployees.CopySelected(); } void AddAllEmployees(object sender, EventArgs args){ ListTransferEmployees.CopyAll(); } void RemoveEmployees(object sender, EventArgs args){ ListTransferEmployees.RemoveSelected(); } void RemoveAllEmployees(object sender, EventArgs args){ ListTransferEmployees.RemoveAll(); } void MoveUp(object sender, EventArgs args){ ListTransferEmployees.MoveUpListControlTo(); } void MoveDown(object sender, EventArgs args){ ListTransferEmployees.MoveDownListControlTo(); } </script> ... <asp:ListBox ID="ListBoxEmployees" Runat="server" SelectionMode="Multiple" CssClass="listbox" /> ... <fluent:ListTransfer Runat="server" ID="ListTransferEmployees" ListControlTo="ListBoxProjectMembers" ListControlFrom="ListBoxEmployees" /> <asp:LinkButton Runat="server" OnClick="AddEmployees"><img border="0" src="images/right.gif"></asp:LinkButton> <asp:LinkButton Runat="server" OnClick="RemoveEmployees"><img border="0" src="images/left.gif"></asp:LinkButton> <asp:LinkButton Runat="server" OnClick="AddAllEmployees"><img border="0" src="images/rightAll.gif"></asp:LinkButton> <asp:LinkButton Runat="server" OnClick="RemoveAllEmployees"><img border="0" src="images/leftAll.gif"></asp:LinkButton> ... <asp:ListBox ID="ListBoxProjectMembers" Runat="server" SelectionMode="Multiple" CssClass="listbox" /> ... <asp:LinkButton Runat="server" OnClick="MoveUp" ><img border="0" src="images/up.gif"></asp:LinkButton> <asp:LinkButton Runat="server" OnClick="MoveDown"><img border="0" src="images/down.gif"></asp:LinkButton>
Fluent.ControlFocus Component Now Available
We have released a new aspect oriented .NET component which may be of interest to developers. It is a very simple non-visual web control which will automatically set focus to a given WebControl after the page has completed loading. This may be useful in situations such as page validation, for example, if you want the cursor to be positioned in a given field which needs correction after a validation failure on postback. The control has one simple attribute, and is used as follows:
<%@ Register TagPrefix="fluent" Namespace="Fluent.ControlFocus" Assembly="Fluent.ControlFocus" %> ... <asp:TextBox runat="server" ID="FirstTextBox" /><br/> <%-- the control below, SecondTextBox, will be focused on page load --%> <asp:TextBox runat="server" ID="SecondTextBox" /> <fluent:ControlFocus runat="server" Control="SecondTextBox" />
Please visit the Fluent Consulting aspect oriented components section for more information or to download this free component!
Evolution
A brief commentary on the life of a software developer:

CLR Proc Container
.NET Framework Bootstrapper
Visual Studio .NET Framework Bootstrapper Plug-in: Home



