Have you thought about customizing the style of the built-in ASP.NET FileUpload control because you are tired of its dull looking? Something like this: I will show you how this can be done very easily. Alright, here is the code snippet of the ASP.NET controls and the JavaScript function: Happy programming!
Tips & Tricks
Here I am gonna use JavaScript and CSS to display a popup-style error window for validation like this: It still uses all validators the same as in Part One, but with some JavaScript functions and some CSS tricks, we can make it look like a pop up.
I have seen several times that some developers use their own JavaScrit functions to validate user input, such as empty input, input format, etc. When asked why not using the built-in ASP.NET validator controls, their answer surprised me: I want to have a popup for displaying all the errors, so I use JavaScript alert function. Actually, it is when the ValidationSummary control comes in handy. The ValidationSummary control has a property called ShowMessageBox, its default […]
When instantiating an instance of the MailMessage class: ‘VB.NET Dim mm As MailMessage = new MailMessage() //C# MailMessage mm = new MailMessage(); you get an exception error: The specified string is not in the form required for an e-mail address. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.FormatException: The […]
Here is the style: .LinkButton { background:url(“imagePath/imageFile.gif”) top left no-repeat; display:block; /* Image will not show up without this line width:32px; /* change to the actual image width */ height: 32px; /* change to the actual image height */ } How to use it? Define the LinkButton as follows: <asp:LinkButton ID=”LinkButton1″ runat=”server CssClass=”LinkButton”></asp:LinkButton> To add a hover effect, for example, changing the background image when hovering the mouse over the LinkButton. […]
You may receive this error when installing a template with .vsi installer, such as AJAXToolkitExtender installer: Installation stopped because the directory for the ProjectType value did not exist. The project type is invalid for your installation of Visual Studio. The cause is the missing of the specific template folder for each language under “C:\Documents and Settings\xxxxx\My Documents\Visual Studio 2005\Templates\ProjectTemplates\”. For VB.NET, manually create a folder named “Visual Basic”; for C#, manually create a folder named […]
Is this error familiar to you? Error while trying to run project: Unable to start debugging on the web server. Click Help for more information. When you click Help button, you get a Topic Not Found page. It is caused by the wrong ASP.NET version the project runs under. It is very common if you have Visual Studio 2003 and 2005 on your machine, then .NET 2.0 will be the targeted by […]
The built-in Tooltip for the CheckBoxList control displays information for the whole CheckBoxList, but what if I want to have a tooltip for each listitem in the CheckBoxList? The ListItem has a very nice property called “Title” which can be used to generate a “tooltip” effect. Here is the code snippet: VB.NET Private Sub CheckBoxList1_DataBound(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles CheckBoxList1.DataBound […]
When you run a SELECT query in your ASP.NET code to fill a DataSet, you may encounter this error: IErrorInfo.GetDescription Failed with E_FAIL(0x80004005) This error is usually caused by the fact that the table name or some column name happens to be a keyword, such as “name”, “first”, and “date”, etc. If it is the case, then use square brackets around those column names as [name], [first], and [date], and it should fix the error.
How can you disable the “X” button on a Windows Form so that user has to click a Close button on the form to close the window? You may say just set ControlBox=False for the Form. But it will hide all the buttons, including the minimize and the maximize button. What if you still want user to be able to minimize/maximize the window? Jose Luis Manners described a very simple but slick way to accomplish […]