Posts

Session Timeout in IIS 7 - Worker Process of ApplicationPool

Image
Problem Recently while testing my application, I was facing problem of Session time out. By Default Session time is 20 mins and I wanted to extend it Attempts if we want to extend it we can set in web.config within System.web tag <sessionState mode="InProc" timeout="30"></sessionState> that I already have done. I set it as 30 mins. but still my session was getting timed out after 20 min. So I doubt that it doesn’t apply to my Code so I set It by code also like System.Web.HttpContext.Current.Session.Timeout = 30; still no progress Resolutions after a long invastigation I came to know Its because Of Default Settings of ApplicationPool for the application in IIS. There is a setting for Worker process of IIS which will set memory and resource to allot to application application wide. in my case I was testing my application alone. So application was being idle for more than 20 min to check weather session is alive or not.. To open the set...

Steps to Remove Menu options in Export for Report Page in SSRS

Hi, In SSRS(Sql Server Reporting Service), I wanted to remove extra options to export my report. Here are the steps to remove option to export like (word, Excel, PDF, MHTML etc...) in SSRS (Sql Server Reporting Service) Installation folder may be different from MSSQL.1, can be MSSQL.x (search for rsreportserver.config under Program Files\Microsoft SQL Server if not found) Here are the steps for Disabling Excel Export Option in Reporting Services - Go to Database server where reporting services is installed, open the rsreportserver.config file located at <Drive Letter>:\ Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer   Go to section.   Change this entry to i.e. add Visible="false" for Excel rendering extension   Same for PDF.   Happy Reporting

Create Excel File From DataTable

Hello Friends, Many times we need to create Excel files in our application using existing Data. I have figured out a class which will help to create excel file by just passing DataTable and preferred location to generate on server. please download the cs file from here .. and use it :) here is full code using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using System.Xml; public class ExcelHelper { private static readonly ExcelHelper _instance = new ExcelHelper(); public static ExcelHelper Instance { get { return _instance; } } /// <summary> /// Create one Excel-XML-Document with SpreadsheetML from a DataTable /// </summary> /// <param name="dataSource">Datasource which would be exported in Excel</param> /// <param name="fileName">Name of exported file</param> public ...

Scroll to particular record in GridView

Hello Friends, here is a tip to scroll the gridview to particular record. the basic concept is html scrolling. to scroll at particular position create an anchor tag with name as address (eg. #ScrollPoint '# is must') now redirect the page to the location using javascript call window.location.href = "#ScrollPoint";   same thing can be achieved by anchorlink href here is sample code HTML Page <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="return MoveTo();" /> <div style="height: 100px; overflow: auto;"> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false"> <Columns> <asp:TemplateField HeaderText="ID" SortExpression="ID"> <EditItemTemplate...

Power of common table expression (CTE)

Image
Hello friends, Recently I came across a case where I was supposed to generate report for Customer based on services availed to him and for that I used A common table expression (CTE) and it really impressed. initially I referred this great document of MSDN http://msdn.microsoft.com/en-us/library/ms190766.aspx here is my Table of data.(Actual Tables are not like this, I have managed a simplified Table for the Demo.) Here is query to generate Table declare @t table (id int identity,CustID int, AgreementName varchar(100), ServDate Datetime,Price float) insert @t select 70 ,'First Agreement',CONVERT(datetime,'2011-01-05'),10 insert @t select 70 ,'Second Agreement',CONVERT(datetime,'2011-01-06'),10 insert @t select 75 ,'First Agreement',CONVERT(datetime,'2011-03-14'),10 insert @t select 70 ,'Second Agreement',CONVERT(datetime,'2011-01-05'),30 insert @t select 75 ,'Third Agreement',CO...

Access UserControl from Page

Image
Hi.. To perform some reparative operation in application, its preferred to use UserControls. Not necessary to have same display and bindings at everyplace. In that case we need to set values or call methods or pass values accordingly. Here I have tried to figure out three cases, Hope it is helpful. Pass Table to Usercontrol and Set dynamically value to Controls Set Properties of control Call Usercontrol's Methods

Set Default Value as Function to column of a Table

Image
Hello, Generally we need to set default value to particular column in Database Table like isActive is true, IsDeleted is false. same way many times we set CreatedOn Date as CurrentDate and that is by query of insert GetDate(). Static Values : Its very easy to set some static value as Default value for column and that is as follow : Functions : Set Default Date for Createdon Field as Follow : User Defined Functions : Set User Defined function as Default Value as follow: In my case I am supposed to get Random Hexa Code for Color. so I Have created an User Defined function for that CREATE FUNCTION [dbo].[GetRandomColorCode] ( ) RETURNS varchar(6) AS BEGIN Declare @Color varchar(6) RETURN (SELECT MyNewID FROM dbo.MyNewID) END Now set the function in columns as follow : If this do not allow us to set Default value try following query to set ALTER TABLE dbo.Table_1 ADD CONSTRAINT DF_Table_1_ColorCode DEFAULT ([dbo].[GetRandomColorCode]()) FOR ColorCode GO Al...