TimeZone : Get the date and time as per time zone

//Get the Collection of System’s Time Zones. System.Collections.ObjectModel.ReadOnlyCollection timeZone = TimeZoneInfo.GetSystemTimeZones(); //Convert time zone collection to LIST List tz = timeZone.ToList(); string strZone=””; try { strZone = tz.AsEnumerable().Where(u => u.DisplayName == “(UTC+01:00) West Central Africa”).SingleOrDefault().StandardName.ToString(); } catch (Exception ex) { Console.WriteLine(ex.Message.ToString()); } TimeZoneInfo timeZone1 = TimeZoneInfo.Local; TimeZoneInfo timeZone2 = TimeZoneInfo.FindSystemTimeZoneById(strZone.ToString()); Console.WriteLine(“================= Time Zone =============”); Console.WriteLine(timeZone1.DisplayName); …

Insert Current DateTime Into SQL Using Asp.Net

Aspx Form Javascript Function For Check validate time inserted or not function CheckTime(Control) { var txtBreakdownTime = document.getElementById(“”); var ddlAMPM = document.getElementById(“”); if (txtBreakdownTime != null && ddlAMPM != null) { var BreakdownTime = txtBreakdownTime.value; var HourNMinute = new Array(); HourNMinute = BreakdownTime.split(‘:’); if (parseInt(HourNMinute[0]) > 12) { alert(“Invalid Time Entry.”); Control.focus(); } if (parseInt(HourNMinute[1]) …

Sort on Gridview

Default.aspx.cs page: Delcare Object DAL objDal = new DAL(); string SORT_DESC = “Desc”; string SORT_ASC = “Asc”; Page Load Event protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { BindCountryGrid(); if (!String.IsNullOrEmpty(Request.QueryString[“Result”])) { DisplayMessage(); } } } Bind Grid Code private void BindCountryGrid() { DataTable dtCountry = new DataTable(); dtCountry = objDal.GetDataTable(“spGetCountry”); if (dtCountry …

File Download Dialogbox With File Extention

Write below code on download button click event…. protected void btnDownload_Click(object sender, EventArgs e) { string imgPath = btnDownload.CommandArgument; // image path goes here…(virtual path) System.IO.FileInfo file = new System.IO.FileInfo(Server.MapPath(imgPath)); if (file.Exists) { HttpContext.Current.Response.AddHeader(“Content-Disposition”, “attachment; filename=drawing”); HttpContext.Current.Response.AddHeader(“Content-Length”, file.Length.ToString()); string strExtention = file.Extension.ToString(); //HttpContext.Current.Response.ContentType = “application/octet-stream”; HttpContext.Current.Response.ContentType = strExtention; HttpContext.Current.Response.WriteFile(file.FullName); HttpContext.Current.Response.End(); } else { lblError.Text = …

Upload images in FCKEDITOR in asp.net

1) Create a folder in root namely ” userfiles ” and inside it create sub folder ” image “. So its like this userfiles \ image 2) Now edit the following lines in fckeditor\fckconfig.js file var _FileBrowserLanguage = ‘php’ ; // asp | aspx | cfm | lasso | perl | php | py var …

SQL split function

DECLARE @str as varchar(max) SET @str = ‘Prakash,Sanket,Jigar,JD’ SELECT value as GiveColumName from dbo.split(@str,’,’) Split function used to insert to multiple records into tables…. see below procedure INSERT INTO BoqThermoDrawing SELECT @BoqNo,@RevisionNo,@RootPath+’\’+value from dbo.Split(@FileNames,’/’) —————————————————————– Create function in sql server… split after that u can use above function USE [DataBaseName] GO /****** Object: UserDefinedFunction [dbo].[Split] …

Open Aspx Page in Popup

Add this function in Search Page or View All items page.. function ShowPopUp(Id) { $get(”).src=”AssignTool.aspx?ID=”+Id; $find(”).show(); document.getElementById(“”).innerHTML = “Assign Tool”; return false; } —————– View All Items page ———–   ——————— view All cs page coding ————— Gridview Row DataBound Event if (e.Row.RowType == DataControlRowType.DataRow) { Button btnAccept = (Button)e.Row.Cells[16].Controls[0]; btnAccept.Attributes.Add(“onclick”, “return ShowPopUpAccept(” + rowView[“AssignToolId”].ToString() …