Follow me on Twitter RSS FEED

Adding Microsoft Report Viewer in Microsoft Visual Web Developer Express 2008

Posted in By waelouf 15 comments

If you want to use Microsoft Report viewer by the free version of Microsoft Visual Studio 2008 (Microsoft Visual Web Developer 2008), you cannot !!! because you will not find the reports tab in the toolbox, even you cannot add a new report because the reporting module is completely unavailable in this "Express" version, but I got a simple way to be able to host a report in your application.

First you will need to install Microsoft Report Viewer from here, once you download it you will have the Microsoft.ReportViewer DLLs in your GAC (Global Assembly Cash), next step is to get these DLLs from you GAC to can use it in your application as following:

1- Open your Command Propmpt and write:
CD C:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms
If you run the command "dir" here you will find two folders




















These are the two versions of Report Viewer for both visual studio 2005 and 2008, 8.0.0.0 for VS 2005 and 9.0.0.0 for VS 2008.

Next step is to copy the required DLL (Whether 8.0.0.0 or 9.0.0.0 according to the version of web express you are using), then go inside the desired folder, and copy the dll to a destination (check the picture):



















Since you get the dll ... go copy and paste it in in your project, then add a new a new tab in your project, and make the reference to this dll inside the project


















One last step, in the web.config => (system.web/httpHandlers part) add:


add verb="*"
path="Reserved.ReportViewerWebControl.axd"
type = "Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"


That's it ... I wish you good luck :)

Disable F1 effect (help) from browser using javascript

Posted in By waelouf 1 comments

This is a simple way to disable the default help in browser if you want to create your own help :)
Most of the code I "borrowed" from Dan Bartels' Blog and just make couple of modifications on it.

enjoy it


document.onhelp = new Function("return false;");
window.onhelp = new Function("return false;");
document.onkeydown = function (evt) {
if (evt == null) evt = event; if (testKeyCode(evt, 112)) //F1
{
cancelKeyEvent(evt); //don't allow default help popup by F1
alert(navigator.appName); alert("This is the new help");
return false;
}
}

function cancelKeyEvent(evt) {
if (window.createPopup) evt.keyCode = 0;
else evt.preventDefault();
}
function testKeyCode(evt, intKeyCode) {
if (window.createPopup) return evt.keyCode == intKeyCode;
else return evt.which == intKeyCode;
}