Wednesday, February 21, 2007

IE Web User Controls deployment in SharePoint 2003 - How to?

Although Microsoft has stopped support for MS IE Web Controls, we would use it when we need some conrols like TreeView in .Net 1.1 - say sharepoint 2003

Steps
1. Add the controls in .ascx (used for web parts)
2. While deploying, copy the Microsoft.Web.UI.WebControls.dll to the bin of WSS root
3. Deploy the above dll in GAC (if required)
4. Run the Build.Bat file from C:\Program Files\IE Web Controls (installation folder). While doing this, care should be taken for CSC.exe location - either run it from VS.Net Command prompt (after switiching to the above location) or include the path of CSC.exe in the "Environment Variables" of system. This will generate a \build\Runtime folder with script file required for the controls
5. Copy the above folder to the root of WSS
6. Exclude the path for the above folder, say webctrl_client (only type the folder name as it is in the root folder) by configuring the virutal server (use SharePoint Central Administration page)

Now it will work!!

-::-

Tuesday, February 20, 2007

How do we generate XSD in VS.Net for reporting from a stored procedure containing #temp tables (local) ?

In many scenarios we may have to use local temp tables in procedures instead of functions returning tables. Always, temp tables are best in performance. When there is any temp table involved in an sp, say for reporting, VS.Net will not allow you to generate a typed dataset (.xsd) out of that.

Resolution

1. Comment the lines containting temp tables in sp
2. Generate .xsd file in .net IDE
3. Uncomment the comments

Yeah!!! It worked

-::-

Monday, February 12, 2007

How to consume a Share Point web service in ASP.Net web ?

It is always an appreciable effort if we consume an existing system as primary reference instead of storing same data here and there

Follow the steps below:

1. Add web reference in the IDE with URL of SPS site
2. Create a proxy class with WSDL.exe utility (available in the VS.Net Tools menu)
Go to command prompt and type as below
wsdl /out: c:\ProxyClass.cs http://server:90/_vti_bin/lists.asmx
Find more options of wsdl here
3. Consume the webservice via proxy class (shouled be added to the project)
4. Now you should get all the published methods in web service via proxy class

-::-

Sunday, February 11, 2007

Crystal Report prompts for report parameters in VS.Net 2005 after being upgraded (VS.Net 2003)

I got parameter prompts when i run my windows application after upgrading to framework 2.0. The application was built on .net 1.1 and was running successfully

Resolution

Pass the parameter after binding the report document to the report viewer component as below. (I passed it before binding to CRV component in .net 2003)

rptDoc.SetDataSource(ds.Tables[0]);
crv.ReportSource = rptDoc;
rptDoc.SetParameterValue("BRAND", Application.ProductName);

-::-

Saturday, February 10, 2007

Configuration Error - Unrecognized attribute 'xmlns' web.config - ASP.net 2.0

When you try running a ASP.net 2.0 web application, you may receive a web.config error as "Unrecognized attribute 'xmlns'"

Line 1: <?xml version="1.0"?>
Line 2:
Line 3: <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
Line 4:

Reason
Your system/server must be running more than one version of .net framework

Resolution
1. Choose Start -> Control Panel -> Administrative Tools -> Internet Information Services
2. Expand the nodes until you can see your virtual directory
3. Right-click on the virtual directory and click Properties
4. Select the ASP.NET tab
5. Under the ASP.NET version, choose 2.0.50215.0
6. Click OK.

Wednesday, February 07, 2007

VS.Net 2005 Templates not found after applying the patch VS80-KB915364-X86-ENU

You might have surprised seeing no templates when you open the VS2005 IDE after installing the patch VS80-KB915364-X86-ENU

Resolution

Regenerate the templates by running 'devenv /installvstemplates' or reinstall
Visual Studio.
Note: Action requires Administrator privileges.

-::-

SQL Server 2000 installation fails with "...previous program installation..." error message

When you install SQL Server 2000, this error message may occur:

"A previous program installation created pending file operations on the installation machine. You must restart the computer before running setup."

Resolution
1.Run the Windows Registry Editor
2.Go to HKEY_LOCAL_MACHINE\SYSTEM\
CurrentControlSet\Control\SessionManager
3.Delete the pendingfilerenameoperations key

Now it should work!!

-::-

Tuesday, February 06, 2007

File upload size limitation in <asp:FileUpload> control

You may receive surprise results when you try to upload a file of size more thatn 4mb with <asp:FileUpload> control

You may not realize it, but there is a limit to the size of a file that can be uploaded using this technique. By default, the maximum size of a file to be uploaded to the server using the FileUpload control is around 4MB. You cannot upload anything that is larger than this limit.

To change this size limit, you make some changes in either the web.config (found in the ASP.NET 2.0 configuration folder at C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG) or your application's web.config file.

In the web.config file, find or add a node as following inside System.Web tag:

<httpRuntime
executionTimeout="110"
maxRequestLength="4096"
requestLengthDiskThreshold="80"
useFullyQualifiedRedirectUrl="false"
minFreeThreads="8"
minLocalRequestFreeThreads="4"
appRequestQueueLimit="5000"
enableKernelOutputCache="true"
enableVersionHeader="true"
requireRootedSaveAsPath="true"
enable="true"
shutdownTimeout="90"
delayNotificationTimeout="5"
waitChangeNotification="0"
maxWaitChangeNotification="0"
enableHeaderChecking="true"
sendCacheControlHeader="true"
apartmentThreading="false" />

By default, this is set to 4096 kilobytes (KB). Simply change this value to increase the size of the files that you can upload to the server. If you want to allow 10 megabyte (MB) files to be uploaded to the server, set the maxRequestLength value to 11264, meaning that the application allows files that are up to 11000 KB to be uploaded to the server.

-::-

Monday, February 05, 2007

How to embed WMP in asp.net pages and how can we redirect the request when the movie ends

You can either user <img> or <object> to embed movies in *.aspx. But to capture the events, you should use the later

Use the below <object tag> to embed WMP in .aspx / html pages
<object id="VIDEO" width="100%" height="100%"
classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"
type="application/x-oleobject">
<param name="URL" value="http://localhost/QaQcTraining/movies/start.wmv" />
<param name="SendPlayStateChangeEvents" value="True" />
<param name="AutoStart" value="True" />
<param name="uiMode" value="none" />
<param name="windowlessVideo" value="True" />
<param name="stretchToFit" value="true" />
</object<

Now, use the below script to capature the events of WMP
<script language=jscript FOR = VIDEO EVENT = playStateChange(NewState) type=text/jscript>
// Test for the player current state, display a message for each.
switch (NewState){
case 1:
//myText.value = "Stopped";
//alert('stoped');
location.href="qform.aspx";
//redirecting to different page after the movie plays
break;

case 2:
//myText.value = "Paused";
//alert('paused');
break;

case 3:
//myText.value = "Playing";
//alert('playing');
break;

// Other cases go here.

default:
//alert('def');
//myText.value = "";
}
</script>