Posts

Showing posts from 2011

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 is the workaround :- in Word 2007, click the "Developer" tab, then "Design Mode" button.  After that, remove

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 HtmlTextWriter(strwriter);        

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++) {                 if (dropdowns.item(i).value != '0') //If dropdown has no selected value                 {                                        flag = true;                     break; //break the loop as there is

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

Deployment Modes for Reporting Services

Deployment Modes for Reporting Services Report server modes are mutually exclusive. You can switch modes by repurposing an existing report server deployment, but there is no supported approach for migrating content between database types. Native Mode In native mode, a report server is a stand-alone application server that provides all viewing, management, processing, and delivery of reports and report models. This is the default mode for report server instances. You can install a native mode report server that is configured during setup or you can configure it for native mode operations are Setup is finished. SharePoint Integrated Mode In SharePoint integrated mode, a report server must run within a SharePoint server farm. A SharePoint site provides the front-end access to report server content and operations. The report server provides all report processing and rendering. Features that behave differently in SharePoint integrated mode The following features behave differently on a repo

SharePoint List Web Part Shared by Sub Sites

Recently I had a requirement where a SharePoint list needs to be available for all sub sites created within a site collection. Consider a scenario where in an organization you have multiple departments having SharePoint sub site for each department and they all want to share an ‘Action Items’ list across all sub sites and main site. Requirement is as follows: • ‘Action Items’ list must be available at each sub-site level. • On the main site when a user log in, user should be able to view Action Items assigned to him. Solution: To achieve this we can have a single list created at parent level and the web part of this list can be reused in subsequent sub sites. Thus by doing this we can have all the data stored in the single list, which can be viewed differently in sub site level as per requirement. • Create a custom web part for that list view, this custom web part supports a tool bar so files can be uploaded and maintained in a single library, but viewed and maintained from any site in