Posts

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" )

SQL Query to Find Column From All Tables within a Database.

Following script will return all the tables containing specific column along with their schema name. USE AdventureWorks GO SELECT t.name AS table_name, SCHEMA_NAME(schema_id) AS schema_name, c.name AS column_name FROM sys.tables AS t INNER JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID WHERE c.name LIKE '%EmployeeID%' ORDER BY schema_name, table_name;

First and Last Day of Week - SQL

Many times you might come across to a situation where you have to find the first and last day of week. Here is the SQL script which can be used to find the first and last day of the week. --Start of Script DECLARE @date datetime -- Will be the date for which you want to have the Start and End of week DECLARE @end_week datetime -- End of week DECLARE @start_week datetime -- Start of week. SET @date = getdate() SET @start_week = DATEADD(d, 1 - DATEPART(dw, @date), @date) SET @end_week = DATEADD(d,6,@start_week ) SELECT @date, @start_week, @end_week --End of Script