ASP.NET

104 posts

Update progress message on top of a transparent layer

When user clicks a submit button, an update progress message shows up, but the background is disabled and transparent. How to do this? We need AJAX. To be specific, we need UpdatePanel and UpdateProgress and some CSS trick. The AJAX part is very simple, and it is the CSS that does the actual trick to create the transparent and disabled background. AJAX part: <asp:UpdateProgress ID=”UpdateProgress1″ runat=”server” AssociatedUpdatePanelID=”UpdatePanel1″> <ProgressTemplate> <asp:Panel ID=”pnlBackGround” runat=”server” CssClass=”popup-div-background”> <div id=”divFeedback” runat=”server” […]

Unable to start debugging on the web server

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 […]

CheckBoxList and Tooltip

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     […]

How to format HyperLink NavigateUrl in designer

GridView control has several new fields to give user more control over the GridView’s format, for example, the HyperLinkField is one of them which enable user to easily format the hyper link in a GridView control. But what if you are using a server control that does not support HyperLinkField, such as DataList, Repeater? How can you format the HyperLink’s NavigateUrl in the designer that is bound to a datatable? The answer is to use […]

It is an error to use a section registered as allowDefinition=’MachineToApplication’ beyond application level

When launching a web application, an error like this shows up: It is an error to use a section registered as allowDefinition=’MachineToApplication’ beyond application level.  This error can be caused by a virtual directory not being configured as an application in IIS. There are several causes for this error: 1. Just like the error says, the virtual directory in IIS is not an application folder. To fix, just go to IIS and expand “Default Website” […]

[JavaScript] ASP.NET Tooltip Alternative

Tooltip is a very nice feature in ASP.NET for displaying additional information when hovering mouse over an item, but the problem with tooltip is that it will go away after about 2 seconds and you will have to move your mouse away and move back to make it appear again. You don’t have any option to change the duration of the display either. It really irritates me for not being able to keep the tooltip […]

[JavaScript] CheckAll/CheckNone CheckBox in GridView

GridView or DataGrid only allows you to delete one row each time and it becomes inefficient and tedious if there are multiple rows need to be deleted. In this post, I will demo how to add a check box in front of each row and also a check box in the header of the grid to check/uncheck all check boxes, then with a delete button to delete those checked rows in a batch mode. I […]

[JavaScript] Force user to check a box before clicking a button

This has been used a lot on those “sign up” forms. User has to select a check box indicating “I read and agree to the license agreement”, or something like that, before he/she can submit the form. Of course, with ASP.NET, you can let user submit the form and then check the state of the check box in the Button.Click event handler to prompt the user if the check bos is not checked. But my […]

[JavaScript]Clear the content of a textbox when it gets the focus

(I truly believe that a professional Web developer cannot live without JavaScript, and I have been busy playing with JavaScript lately and I will post some common but useful JavaScript code here.) Here is the JavaScript code: <script language=”javascript” type=”text/javascript”>        function clearBox(id)         {            var txt = document.getElementById(id);            if (txt.type != “text”)            {              alert(“Error: parameter type mismatch in clearBox function. TextBox type expected.”);            }            else           {                […]

Prevent browser from remembering inputted data in text box

Browser has a handy feature that remembers the information entered earlier in text boxes, and this feature can save you a lot of time when you fill up a form on-line. Sometimes, however, this feature may cause unwanted behaviors, even security concerns. For example, browser should not remember the credit card number that was entered. Another example is if you have a RegularExpressionValidator to validate a text box field, and if the text box has […]