If you write Windows forms applications for a living then you will probably have visited the Windows Forms site before. If not, it has interesting articles, sample code, downloads and upcoming trends you should know about. Worth a visit.
Month: October 2006
Using ASP.NET 2.0: CompareValidator Controls
You can use a <asp:CompareValidator> control to validate one control against another or against a fixed value. I spent an hour searching for a way to use one to validate a date that should be greater than or equal to today’s date. My initial attempt was
<asp:CompareValidator ID=”cvFromDate “ Text=” Date cannot be less than today’s date!” ControlToValidate=”txtFromDate” Type=”Date” Operator=”GreaterThanEqual” SetFocusOnError=”true” Display=”Dynamic” Runat=”server” ValueToCompare=”<%= DateTime.Today.ToShortDateString() %>“ />
But it did not like the fixed date value. Interestingly, several articles I found said this was possible, but I had no luck getting it to work (I suspect this is due to initialisation and binding event order?). The simple solution is to set this value during the page’s load event:
if (!IsPostBack)
{
cvFromDate.ValueToCompare = DateTime.Now.ToShortDateString();
The final ASP.NET code which also includes a compare validator to check the same control for dates in valid formats is:
<asp:CompareValidator ID=”cvFromDate” Text=” Date cannot be less than today’s date!” ControlToValidate=”txtFromDate” Type=”Date” Operator=”GreaterThanEqual” SetFocusOnError=”true” Display=”Dynamic” Runat=”server” />
<asp:CompareValidator id=”CompareValidator1″ Text=”Please enter a valid date format.” ControlToValidate=”txtFromDate” Display=”Dynamic” Type=”Date” Operator=”DataTypeCheck” SetFocusOnError=”true” runat=”server” />
Development Zen
Any task that is repeatable is a candidate for automation
Any coding task that is repeatable is a candidate for code generation
More Free .NET 3.0 Resources: .NET University
.Net University? It might sound a little corny, but hey it’s another free resource for getting up to speed with .NET 3.0 (WPF, WCF, WF and CardSpace).
“Content is freely downloadable, and available for re-delivery to technical
audiences…includes four 75 minute lectures and four 30 minute labs.”
Thanks to tip from Brian Randell
Advanced Article on ASP.NET 2.0 Master Pages
Whilst searching for the solution of referencing a control defined in a content page from JavaScript, I found this great article ASP.Net 2.0 – Master Pages: Tips, Tricks, and Traps by K. Scott Allen. It’s definitely one of the most comprehensive, in-depth articles I’ve come across (despite having bought two fairly advanced books on ASP.NET 2.0!). Scott Guthrie linked to this article a while ago here. The article describes how master pages and content pages are combined, event ordering, interacting between the master page and content pages and vice versa, JavaScript and naming containers, and name mangling (the bit that solved my particular problem).
Free E-Learning Courses:
Microsoft Learning has several introductory courses currently being offered for free:
- Course 2913: Creating Your First Microsoft® ASP.NET 2.0 Web Application
- Course 4336: Upgrading from Microsoft® Visual Basic® 6.0: Introduction to the Microsoft .NET Framework
- Workshop 4249: Performing Asynchronous Tasks by Using Multithreading with Microsoft® Visual Studio® 2005
- Workshop 4260: Building and Consuming a Simple XML Web Service with Microsoft® Visual Studio® 2005
The Visual Studio section is also providing a series of free e-learning courses centred around .NET 3.0 (Collection 5134 : Developing Rich Experiences with Microsoft® .NET Framework 3.0 and Visual Studio® 2005). These courses introduce working with Windows Presentation Foundation, Windows Workflow Foundation, and Windows Communication Foundation. They are aimed at experienced Developers and Software Architects who are looking to adopt Microsoft’s next generation technology:
- Clinic 5135 : Introduction to Developing with Windows® Presentation Foundation and Visual Studio® 2005
- Clinic 5136 : Introduction to Developing with Windows® Workflow Foundation and Visual Studio® 2005
- Clinic 5137 : Introduction to Developing with Windows® Communication Foundation and Visual Studio® 2005
Database Refactoring
A post over on Larry O’Brien’s blog prompted me to put together this short list of resources that can assist with database factoring and understanding an unfamiliar database:
- Visual Studio CTP for Database Professionals, you can download CTP 5 – Beta here.
- Red-Gate’s SQL Dependency Tracker (14-day trial download available). Larry notes:
“One limitation is that the tool does not have a “Print” capability. I would
like to print out a (huge, wall-sized) poster of the dependency for study. It
does, though, have an “Export to image…” capability. If you save to .PNG it
does not preserve detail, but if you save to .EMF, you can import it into
Illustrator and divvy it up there.” - The book “Refactoring Databases: Evolutionary Database Design” by Scott W. Ambler and Pramod Sadalage, has received excellent reviews (unfortunately mine is on order). There is a dedicated website here
- Sparx Systems Enterprise Architect is a comprehensive database design tool.
Having access to an A1 size plotter is also very useful!
CSS Layout Tools
Saw this great tip via Eric Gunnerson’s blog post on two tools that can help with web page layout and design. I’m in Eric’s corner when it comes to CSS; I’m definitely no expert, and need all the help I can get!
CSSVista lets you see the effect on CSS changes in real-time:
CSSVista is a free Windows application for web developers which lets you edit
your CSS code live in both Internet Explorer and Firefox simultaneously. … This
is a very early version of the software. It probably won’t explode, but it may
not work perfectly 100% of the time.
The IE Developer Toolbar has a DOM viewer that lets you see a tree view of how a web page is structured.
SQL Server 2005 Practical Troubleshooting
Here’s one SQL Server 2005 book I’m really itching to get my hands on: SQL Server 2005 Practical Troubleshooting by Ken Henderson.
Ken posted a blog entry on his new book here. If you have not heard of Ken Henderson before, he is renowned for his excellent ‘Guru’s Guide’ series books on T-SQL and SQL Server internals.