Wednesday, November 26, 2008

How to get rid of "Warning as an Error" message

In the web config file, added the following add in Red under the compilers section for each compiler you have.

<compilers>

<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

<providerOption name="WarnAsError" value="false"/>
</compiler>

</compilers>

The type or namespace name 'Script' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)

To resolve this problem, please ensure that you have the system.web.extension dll added as a reference in your project.

Alternatively, copying the system.web.extension.dll to the bin directory for a deployment project should resolve the problem.

Wednesday, November 05, 2008

How to Show File Dialog

Here is some code to allow users to select Folder.

public class FolderBrowser : FolderNameEditor
{
private FolderNameEditor.FolderBrowser m_obBrowser = null;
private string m_strDescription;
public FolderBrowser()
{
m_strDescription = "Select folder";
m_obBrowser = new FolderNameEditor.FolderBrowser();
}

public string DirectoryPath
{
get{return this.m_obBrowser.DirectoryPath;}
}

public DialogResult ShowDialog()
{
m_obBrowser.Description = m_strDescription;
return m_obBrowser.ShowDialog();
}
}