Asp.net

Export to excel 2003 File Formate

Down Load Dll File http://npoi.codeplex.com/releases/49524/download/140879 Create  .Cs as Class file using System; using System.IO; using System.Data; using System.Collections.Generic; using System.Linq; using System.Web; using NPOI.HSSF.UserModel; using NPOI.SS.UserModel; using NPOI.SS.Util; using NPOI.HSSF.Util; using NPOI.POIFS.FileSystem; using NPOI.HPSF; public class NpoiExport : IDisposable { const int MaximumNumberOfRowsPerSheet = 65500; const int MaximumSheetNameLength = 25; protected Workbook Workbook { get; set;Continue Reading “Export to excel 2003 File Formate”

Asp.net

Sorting In GridView

On Gridview Field assign Sortexpression properties = Field Name GridView Sorting Event: protected void grddmndsetup_Sorting(object sender, GridViewSortEventArgs e) { DMNDRATEBLL obj_DMNDRATEBLL = new DMNDRATEBLL(); obj_DMNDRATEBLL.DmndRate_Id = 0; obj_DMNDRATEBLL.DmndRate_Clarity = 0; obj_DMNDRATEBLL.DmndRate_Shape = 0; obj_DMNDRATEBLL.Dmnd_Rate = 0; obj_DMNDRATEBLL.DmndRate_Color = 0; obj_DMNDRATEBLL.DmndRate_WtEndrange = 0; obj_DMNDRATEBLL.DmndRate_WtStartrange = 0; obj_DMNDRATEBLL.DmndRate_Date = Convert.ToDateTime(“12/1/2000”); obj_DMNDRATEBLL.Is_Show = true; DataTable dt = obj_DMNDRATEBLL.GET_DMNDRATE(); dt.DefaultView.Sort =Continue Reading “Sorting In GridView”

Asp.net

Progress For long Running process

Add Script in header section <script type=”text/javascript”> HideWait(); </script> Add Belowe code in pageload event in .cs file Response.Write(“<div id=’mydiv’ style=’display:none’>”); Response.Write(“<center><img src=’../Images/Progrees_Bar1.gif’><br/><b>Image verification in progress…….</b></center>”); Response.Write(“</div>”); Response.Write(“<script>mydiv.innerText = ”;</script>”); Response.Write(“<script language=javascript>;”); Response.Write(“var dots = 0;var dotmax = 10;function ShowWait()”); Response.Write(“{var output; output = ‘Loading’;dots++;if(dots>=dotmax)dots=1;”); Response.Write(“for(var x = 0;x < dots;x++){output += ‘.’;}mydiv.innerText = output;}”);Continue Reading “Progress For long Running process”

Asp.net

Convert datetime accroding to system date formate

Using  CultureInfo public string DateFormat { get { return dateFormat.Replace(“\\/”, “/”); } set { dateFormat = value.Replace(“/”, “\\/”); } } private void ResetDateFormat() { DateFormat = CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern; } public DateTime CalendarDate { get { DateTime date; if (DateTime.TryParseExact(txtDate.Text, dateFormat, null, System.Globalization.DateTimeStyles.None, out date)) { return date; } return DateTime.MinValue; } set { txtDate.Text = (valueContinue Reading “Convert datetime accroding to system date formate”

Asp.net

Keep session alive

Add page sessionloginalive.aspx in your project: protected void Page_Load(object sender, EventArgs e) { Response.AddHeader(“Refresh”, Convert.ToString((Session.Timeout * 60) – 120)); } Add iframe in master page within a body tag <iframe id=”MaintainSession” src=”~/SessionloginAlive.aspx” style=”display:none” width=”0″ height=”0″ runat=”server”></iframe > Add a Script in head section of master page <script type=”text/JavaScript”> <!– function timedRefresh(timeoutPeriod) { setTimeout(“location.reload(true);”, timeoutPeriod); }Continue Reading “Keep session alive”