Archive for October, 2008

The problem with Microsoft VSS and Copy web in Visual Studio .net

Asp.NETWhen I am using the Copy Web command in the Microsoft Visual Studio .net 2005 to copy asp.net files from the local to the remote server, sometime I got error saying “Access denied” (BTW, to see the Error Log, you will have to scroll down and click the Log… button which might be invisible if you have a small screen).

To resolve this problem, you will have to logon to the remote server to make sure

  • The destination folder is opened with Write permission for the ASP.NET users
  • If you are replacing the files, please make sure the files are not READ ONLY on the remote server

The item #2 happened to me a lot, and I had to uncheck the READ ONLY checkbox from the files’ properties. The only explanation I can come up is that the Microsoft Visual Safe 6.0 sometime made the files READ-ONLY since we are using VSS for the coding collaboration.

Related posts

How to set the DefaultButton in a Page Based on ASP.NET Master Page

Challenges:

Asp.NETAs I mentioned in my previous post, I fixed the issue of hitting enter key on an ASP.NET page with a single textbox and submit button. But now new issue occurred: I could not use the Enter key on other button web controls. Whenever I hit the Enter key in the web form, the onClick event of the search button fires not the other submit buttons. I know I am Master page and the search button has been included in every page based on this master page, and the search button is in the first button web control position.

Trouble Shootings:

OK, the first thing came to my mind to resolve the issue above was to use the  new DefaultButton properties in ASP.NET 2.0 form or panel controls. But since I am using Masterpage, when I put defaultButton=”btnSubmit” in master page or put the following code in my Page_load event

Page.Form.DefaultButton = “btnSubmit”

I got the following error:

Server Error in ‘/MyApplication’ Application.
The DefaultButton of ‘form1′ must be the ID of a control of type IButtonControl.

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.InvalidOperationException: The DefaultButton of ‘form1′ must be the ID of a control of type IButtonControl.

Continue reading ‘How to set the DefaultButton in a Page Based on ASP.NET Master Page’

Related posts

How to fire onClick event with hitting Enter in ASP.NET forms

Challenge:

Asp.NETI have a search box in every asp.net web page with one text box and one submit button. When the visitor clicks the submit button, he will be re-directed to a search result web page since the onClick event is fired on that submit button. But when the visitor finishes his typing and simply hits the enter key, a postback event will be fired on the page level but the onClick event of that submit button could be not fired.

Solutions

After reviewing the HTML codes and HTTP requests, I found out the pair of button name/value has not been sent to the form along with the text box. That was the reason why the page could not decide whether the submit button triggered then not fired the onClick event.

I am using ASP.NET 2.0 and experiencing such issue, and not sure whether ASP.NET 3.5 still have the same issue. But a simple work-around can fix this issue - which is to add one more textbox web control.

For example, if you only have one textbox and submit button, the query string post back to the server will be

default.aspx?txtBOX1=some+value&

But if you have more than one text boxes in your asp.net page, then your string will be

default.aspx?txtBOX1=some+value&txtBOX2=some+value…btnSubmit=Search…

Of course, you do not want the visitors to see your addtional textbox, you should use a style to hide it. Do not use visibility property since that will disable that textbox web control. So your new textbox will look like the below

<asp:TextBox ID=”txtInvisible” runat=”server” Style=”visibility: hidden; display: none;” />

In this way, when the visitor express the Enter key, your first button web control will be fired.

[update: if you have multiple button web controls and want to control which one to be fired while the visitor hits the Enter key, please read on my next post]

Related posts

How to use XML Sitemap plug-in with WordPress MU

A couple months ago, I wrote a blog post in my Chinese blog about my own experience of configuring XML SiteMap plugin in the WordPress MU. It turned out that a lot of MU owners had the same problem before. So I decided to re-write it in English and share with you here.

I guess you should be familiar what the Google SiteMap is if you would like to increase your website/blog’s rank in search result. And you are using WordPress as your blogging platform, you might be interested in a plug-in called Google (XML) Sitemaps Generator for WordPress, which can allow you to easily generate Google XML SiteMap within your blog. But unfortunately the XML Sitemaps Generator (version 3.0.3) I used was not developed for WordPress MU. By default, it could only generate the XML sitemap for the primary blog not all other blogs in your WordPress MU.

Well, you can try your lucks on the author’s website to see whether he/she released a newer version to resolve the issue, or you can do it yourself by changing a few lines of code as I shared below.

Continue reading ‘How to use XML Sitemap plug-in with WordPress MU’

Related posts