Monthly Archives: August 2008

substract datetime in c#

Problem: Substraction datetime in c#, in this case from textboxes Solution: DateTime _Text1 = DateTime.Parse(Text1.Text); DateTime _Text2 = DateTime.Parse(Text2.Text); System.TimeSpan result = _Text1 – _Text2 ; Response.Write(result.TotalDays); –> display the total days diffrence

Posted in asp.net, c# | Leave a comment

Response redirect target blank

Problem: Repsonse.Redirect cannot open the url in "target blank" mode Solution: javascript, for example: Response.Write("<script language='javascript'> window.open('" + DropDownList.SelectedValue + "', 'window');</script>"); from jose:   Response.Write("<script type='text/javascript'>");         Response.Write("document.location = 'http://www.google.com';");         Response.Write("</script>");         Response.End() ;

Posted in asp.net, javascript | 2 Comments