ASP.NET

104 posts

Not well-formatted server control freezes up Visual Studio .NET 2003, bug?

1. Add a new web form in Visual Studio.NET 2003, say Webform1.aspx 2. Switch to the HTML view of Webform1.aspx, then add a line as follows: <asp:Label=”lblFirstName” Runat=”server” CssClass=”label-cell”>First Name:</asp:Label> Note: the “ID” and the space before “ID” are missing. 3. Switch to the Designer view, Visual Studio.NET 2003 freezes up. 4. Launch the Process Explorer and notice the CPU usage of Visual Studio.NET 2003 is around 45-50%. Same result with other server controls. You […]

Manually remove Visual SourceSafe control from a solution

There are different ways to remove the Visual SourceSafe control from a controlled solution, and the easiest way is to use the built-in Unbind feature in Visual Studio: select the solution from the Solution Explorer, then open File menu and select “Source Control” then “Change Source Control”. When Change Source Control window loads up, check all the projects in the project list and click “Unbind”, then confirm your action and finally exit out. Now the […]

FCKEditor Configuration in ASP.NET

In my previous post, I demonstrated how to install and integrate the FCKEditor control, an open source, rich format text editor, with ASP.NET. The installation and integration are actually easy, and if you followed through the previous post, you should have a screen like this after you run the demo project: The first thing came to your attention when you see this page might be, there are too many toolbar items in the editor, how […]

FCKEditor integration with ASP.NET

0. Why I wrote this post? FCKEditor is an open-source, rich text editor for the web application, its features include multi browser compatibility, XHTML1.0 output, CSS support, font and text formatting, image insertion with upload and server browsing, table creation and editing, spell checking, toolbar customization, and more. It also integrates with many major web application languages, such as ASP, ASP.NET, PHP, Java, ColdFusion, Perl, JavaScript and more. Although there is a developer’s guide on […]

System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% … %>)

I got this error when I was working on a small AJAX demo project the other day. In this project I only have two TextBox controls and two AJAX CalendarExtender controls: one text box is for a begin date entry controlled by one CalendarExtender, and the other text box is for an end date entry controlled by the other CalendarExtender. Quite simple, right? However, the AJAX CalendarExtender does not have the ability to force user […]

AJAX UpdatePanel Causing Full Postback

When you use AJAX’s UpdatePanel, you may find that the controls inside of the UpdatePanel generate full postback instead of partial postback, if it occurs to you, then you may need to check your web.config file to see if there is a line like this: <xhtmlConformance mode=”Legacy” /> If yes, then that is the bad guy that causes all kinds of problems in AJAX including the issue mentioned above. Removing the line from web.config  will […]

Adding Background Color to RadioButtonList Items

With the same CSS and similar code as I posted before for adding background color to CheckBoxList items, we can do the same thing to a RadioButtonList control. Here is the code-behind file: Private Sub RadioButtonList2_DataBound(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles RadioButtonList2.DataBound Dim cols As Integer = Me.RadioButtonList2.RepeatColumns If (cols = 0) Then cols = 1 End If For i As Integer = 0 To Me.RadioButtonList2.Items.Count – 1 Dim j As […]

Adding Background Color to CheckBoxList Items

UPDATE 12/08/2008: The CheckBoxList control in my example has RepeatColumns=0 and RepeatDirection=Vertical. if your RepeatColumns > 0, then you will need to change RepeatDirection=Horizontal, and also change the code behind as follows: Private Sub CheckBoxList1_DataBound(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles CheckBoxList1.DataBound Dim cols As Integer = Me.CheckBoxList1.RepeatColumns If (cols = 0) Then cols = 1 End If For i As Integer = 0 To Me.CheckBoxList1.Items.Count – 1 Dim j As Integer […]

File download with Response stream not working in UpdatePanel

It is very common to use the Response stream to manage file download process. For example, the following code snippet shows how to use the Response stream to download any file: The above code will work fine in most cases, however, if the Download button is in a UpdatePanel, then it will throw an AJAX error like this: The error message tells the cause the error: you cannot use Response.Write in the UpdatePanel, so how […]