Hit Enter Key in a TextBox to Submit a Form – ASP.NET

In ASP.NET, by default, hitting the Enter key in a TextBox fires the Click event of the first button found in the form.
For example, you have sub-forms within a <form> element and each form requires its own default button.
The default action of firing the first button found on a Web page is not what we want.
Making the <form> run at server and setting a DefaultButton property for the form is not a solution since it can only assign one button as the default button.
Having more than one server-side forms is not a solution either since it will not work.

One solution is to surround each sub-form with <asp:Panel> element and setting its DefaultButton property to a desired button.
This way, you can have many sub-forms on one page with their own default buttons :)

Enable Firefox to Access a SharePoint Site Without Logging In

By default, you will need to provide a username and password for accessing a SharePoint site via Firefox even though you are in the same domain as SharePoint’s.
This does not happen in IE.
To enable an automatic login for Firefox, you will need to configure Firefox to use Windows’s built-in NTLM authentication.
To do so, follow the steps below:

  1. Type about:config in Firefox’s address bar and press Enter key.
  2. In the Filter textbox, type network.automatic-ntlm-auth.trusted-uris and press Enter key.
    You should now see the specified setting appearing in the preference name section.
  3. Double click the preference name (or right click and choose Modify) to modify the value.
  4. In the appearing dialog, enter the SharePoint server URLs (with no tailing “/”) separated by a comma and click OK when done.

That’s all and you are good to go :)

A Class in App_Code Folder Does Not Get Compiled

Today I’ve experienced one odd thing with Visual Studio 2008.
As we know, App_Code is not needed for a Web application project under VS2008 since class files can be put anywhere.
However, to keep it clean and easy to find, I decided to created one and create class files under the folder.
It appears that those created objects do not be available.
In the other words, they do not get compiled.
After messing around, I found that the “Build Action” property of those files have been set to “Content” by default.
Well, it should be “Compile” so that the files get compiled.
I’ve also tried to create another folder with the name of “cs”.
The created class files under “cs” have the “Build Action” property of “Compile”.
Therefore, the solution is either set the “Build Action” property to “Compile” or never use a folder with the name of “App_Code”.

Now the question is… why does the “Build Action” property of the files under “App_Code” is “Content”?