Posts

SharePoint assemblies: Local Deployment

Image
All assemblies provisioned by the solution will be deployed to the Global Assembly Cache (GAC) of the target web server which might not always be desirable/doable. There are a couple of ways of how to change the DeploymentTarget to the bin directory of the target Web Application. One way of changing the WSPBuilder’s default behavior is using the WSPBuilder.exe.config file. Changing the value of the DeploymentTarget settings would be applied globally instead on a per-project basis. Every WSP you build  on your development machine using WSPBuilder would be built with the DeploymentTarget set to WebApplication. While such approach would do the job, it would take away the flexibility that WSPBuilder is supposed to provide. Another way of overriding the default setting is using the command line version from either MSBuild or post-build actions. Using the –DeploymentTarget switch you could set the DeploymentTarget to WebApplication. You are very likely to use this approach if you’...

Web.Config setting: Displaying Errors for .NET and SharePoint Sites

To display full errors and the stack trace of the error, you need to modify the web.config file for the Web Application which SharePoint is running on. There are a number of web.config files required to configure various components of SharePoint. See notes below for more information about modifying the web.config file to display errors. Enable Custom Errors : Set the customErrors mode to “Off” Find: customErrors mode=”On”  Change To:  customErrors mode=”Off” Enable the Call Stack Trace : Set the CallStack value of the SafeMode element to “true” Find: SafeMode … CallStack=”false” Change To:  SafeMode … CallStack=”true” Enable Debugging Mode : Set batch and debug to “true” Find: compilation batch=”false” debug=”false” Change To:  compilation batch=”true” debug=”true” Enable the ASP.NET tracing feature : Include the following line in the element of the web.config file. trace enabled=”true” pageOutput=”true”

Identifying Worker Process W3WP.exe PID

Image
If you are debugging a ASP.NET web application which is hosted on IIS, you need to attach the particular worker process in Visual Studio to start debugging. To Attach a process we can go to  Tools > Attach Process  or use shortcut key  Ctrl +P . The process window will show the  worker process (w3wp.exe)  which is currently running on IIS. You need to select the process and click on attach button to start the debugging. Problem starts when you have  multiple worker process running on IIS .  If you have multiple sites hosted on IIS and each site having their own application pool then you will see the list of all worker process in the Process Attach window. Here  you need to identify the particular worker process which is associated with your application pool. Identify Worker Process in IIS 6.0 • Start > Run > Cmd • Go To  Windows > System32 • Run  cscript iisapp.vbs • You will get the list ...

Workaround: Blank document property has value [fieldname] in Word (SharePoint Document Library)

In one of my SharePoint project which involved SharePoint Workflow to create new document by values entered in SharePoint list which gets copied to SharePoint document library and in turn generate document with the values, these values  are visible as quick part in document property pane.  Following steps are performed on SharePoint part: ·           A document library which has a Word document associated which is used as the basis for all new documents ·           A list containing the fields that we want to pass into a new document ·           A workflow which creates a new Word document and copies the fields from the list into the document The problem which I had been facing is that the 'Quick Parts' in word document is showing by default 'Quick Part' name even when the value was not being entered. So to resolve this issue here i...

Exporting DataTable To Excel using ASP.NET

In continuation to my previous post which addressed Export to Excel issue in ASP.NET ( click here ), here is another post which is a solution for Exporting a DataTable to Excel using ASP.NET. Many times we come across scenario where we don't need to show the grid and just export data which is available in DataTable to Excel. You can use following method by passing the DataTable as parameter, which in turn export the data to Excel. I have implemented with AJAX also without any issue. Note: While using AJAX on a button click, do not forget to Add a PostBackTrigger to your UpdatePanel that points at the button, otherwise it will give "Sys.WebForms.PageRequestManagerParserErrorException"  Exception because of violation of using Response.Write bypasses the normal rendering of ASP.NET control. private void ExportGridToExcel(DataTable dt) {         StringWriter strwriter = new StringWriter();         HtmlTextWriter htmlwriter = new HtmlTe...

Client side Validation for DropDownList value in GridView

Client side Validation for DropDownList value in GridView to check if any value is selected or not. Add following code on 'OnClientClick' event of the asp.net button OnClientClick="javascript:return validateGridComboBox(); Javascript Function: function validateGridComboBox()      {             var flag = false;             var dropdowns = new Array(); //Create array to hold all the dropdown lists.             var gridview = document.getElementById('<%=GridView1.ClientID %>'); //GridView1 is the id of ur gridview.                          dropdowns = gridview.getElementsByTagName('select'); //Get all dropdown lists contained in GridView1.                         for (var i = 0; i < dropdowns.length; i++) {       ...

Add alternating row color to SSRS Reports

Go to the table row's BackgroundColor property and choose "Expression..." Use this expression: = IIf ( RowNumber ( Nothing ) Mod 2 = 0 , "Silver" , "Transparent" )