Sunday, January 13, 2008

How can a web page go to the bottom end as soon as it is loaded?

I needed to get a loaded web page to scroll down to the bottom of a long page. I was able to make that happen using some basic JavaScript. Here's my solution:


1) Place the following HTML at the page loaction where you want to go to automatically:

<a id="bottom" name="bottom"></a>

2) Add the following ASP.NET code that triggers some very basic JavaScript:

StringBuilder sb = new StringBuilder();

sb.Append("<script language='javascript' >");

sb.Append("window.location.href = '#bottom';");

sb.Append("</script>");

ClientScript.RegisterStartupScript(typeof(Page), "Focus", sb.ToString());

Although thic technique pertains to ASP.NET 2.0, it really can be implemented in any other server-side technology.

Thursday, January 3, 2008

Unable to delete or customize a choice field in WSS 3.0

I needed to customize the HelpDesk template that is freely downloadable from Microsoft. I discovered that it is not possible to add any choice items or even delete the column. Here's what I experienced when I clicked on:
Service Requests ==> Site Settings ==> List Settings ==> Status

You will notice that the "Delete" button is missing and no choice items can be changed.
I discovered that the choice field is sealed in the feature template itself.

Solution:

1) Open the schema.xml file located in the SharePoint 2007 12-hives directory at:

%ProgramFiles%\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\HelpDeskServiceRequestsList\servicerequest

2) Search for the Status field.

<Field ID="{75AF1E7D-39F1-45db-908A-B7AD3F26531A}"

Type="Choice"

Name="Status"

DisplayName="$Resources:hlpdsk,SRStatus;"

StaticName="Status"

Required="TRUE"

Sealed="TRUE"

Format="Dropdown"

FillInChoice="FALSE"

SourceID="http://schemas.microsoft.com/sharepoint/v3"

>

<Default>$Resources:hlpdsk,SRStatus_Choice1;</Default>

<CHOICES>

<CHOICE>$Resources:hlpdsk,SRStatus_Choice1;</CHOICE>

<CHOICE>$Resources:hlpdsk,SRStatus_Choice2;</CHOICE>

<CHOICE>$Resources:hlpdsk,SRStatus_Choice3;</CHOICE>

<CHOICE>$Resources:hlpdsk,SRStatus_Choice4;</CHOICE>

</CHOICES>

</Field>

3) Change the Sealed attribute value from TRUE to FALSE

4) Save the schema.xml file

5) Restart IIS