ASP.NET

104 posts

Sending email with Visual Studio 2008 in Windows 7 by using Free SMTP Server

You may already know that Microsoft dropped SMTP in client OS since Windows Vista, so apparently Windows 7 will not have SMTP either. If you need a SMTP on your local machine to test and debug your mail function as I do, you can install a free third-party SMTP server called Free SMTP Server. The installation is very straight forward and you don’t need to do any customization. In your application, just use “localhost” as […]

Configure IIS 7 to work with Visual Studio 2008 in Windows 7

You should install IIS 7 prior to the installation of Visual Studio 2008, otherwise, you will need to run command aspnet_regiis –i with administrator permission. If you install IIS 7 with the default settings, you will get this error when you try to use local IIS instead of the built-in web server in VS 2008, or when you try to create a new web site project on local IIS instead of using the file system. […]

Conditionally validate form by using ASP.NET validators and JavaScript

It is a common requirement to validate different fields on an ASP.NET form based on different conditions, for instance, if user selects “Other” from a Drop Down List, then he/she will be required to type in something in a TextBox control. It can be done easily in code behind, but can we accomplish the same task at the client side? The answer is yes. We can use ASP.NET validation’s client API to conditionally enable/disable validators. […]

Use jQuery to style ASP.NET GridView

In ASP.NET, the style of GridView is usually controlled either by using a CSS file or by using a skin file and in many cases this works well, but what if we need to style the GridView as follows: Of course it can be done in code behind by looping through the GridView rows and applying different CSS class for each row. It needs at least a “For” loop and a calculation of the reminder […]

Using jQuery with ASP.NET – Why is it not working??

jQuery? What? jQuery is a powerful JavaScript library which aims to reduce the time and effort for writing JavaScript code, and to support Unobtrusive JavaScript. Take the following line of code as an example: $(“table tr:nth-child(even)”).addClass(“yellow”); The above line highlights every other row in a table with a yellow color (assume you have a style called “yellow”). If you use raw JavaScript, it may take you dozens of lines of code to accomplish the same […]

An enhanced way to display validation errors in ASP.NET

We are all familiar with ASP.NET validators and know how to use them to give user instant response when invalid data is entered. Today, I am going to show you an enhanced way to display validation errors by using JavaScript and ASP.NET valiation client API, for instance, when a control causes a validation error, besides display an error message (or an icon), we can add a red border around the control and also change its […]

Display Full Size Image on Mouse Over Thumbnail in ASP.NET

How to display a full size image when user hovers mouse over a thumbnail image? 1. Add an ASP:Image control for displaying the full size image: <asp:Image ID="imgOriginalImage" runat="server" style="display:none;" /> Since the full size image will not show up until the mouse is hovered over thumbnail, so the image is hidden initially. 2. Use a DataList control to display the thumbnails: <asp:DataList ID="dlThumbnails" runat="server" DataKeyField="Name" DataMember="Name" RepeatColumns="3" Width="100%"> <ItemTemplate> <asp:Image ID="imgThumbnail" runat="server" /> </ItemTemplate> […]

ASP.NET tooltip alternative: Cool DHTML Tooltip II – Part 3

In Part 1 and Part 2, I talked about how to use Cool DHTML Tooltip II to replace ASP.NET built-in tooltip for better user experience. However, you may notice that if you use Cool DHTML Tooltip II in an AJAX ModalPopup, the tooltip is displayed underneath the ModalPopup. It turns out that when the AJAX ModalPopup is generated, its z-index is always reset to 100001 so the popup window is always on top of other […]

How to use the ‘Save’ icon in FCKEditor to save FCKEditor content on the server side in ASP.NET

I wrote two posts before regarding the integration and the customization of FCKEditor in ASP.NET and was asked by a reader how to use the “Save” icon  in the FCKEditor’s toolbar set to perform the actual save on the server side. I am sorry for the long delayed answer for that question because I have been tied up with my work and haven’t had much time to look into the problem until recently. When the […]