jquery reference problem
Etiketler: jquery , js , reference , scriptreference
sort a generic list
public struct SlideObject : IComparable
{
public int Id { get; set; }
public string Title { get; set; }
public string NavUrl { get; set; }
public string ImgUrl { get; set; }
public DateTime AddDate { get; set; }
public static Comparison
//public static Comparison
//{
// return so1.AddDate.CompareTo(so2.AddDate);
//};
#region IComparable
public int CompareTo(SlideObject other)
{
return AddDate.CompareTo(other.AddDate);
}
#endregion
}
http://dotnetslackers.com/community/blogs/simoneb/archive/2007/06/20/How-to-sort-a-generic-List_3C00_T_3E00_.aspx
http://www.codeproject.com/KB/linq/Article.aspx?aid=27834
Etiketler: generic list sorting
export data to excel in asp.net
Page Language="C#" AutoEventWireup="true" EnableEventValidation="false"
public override void VerifyRenderingInServerForm(Control control) {
/* Confirms that an HtmlForm control is rendered for the specified ASP.NET
server control at run time. */
}
//Export to Excel from a GridView
protected void ExportToExcel() {
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("content-disposition", "attachment;filename=MyFiles.xls");
// for turkish support
Response.ContentEncoding = Encoding.GetEncoding("ISO-8859-9");
Response.Charset = "ISO-8859-9";
this.EnableViewState = false;
System.IO.StringWriter sw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw);
gvFiles.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
}
http://blogs.msdn.com/erikaehrli/archive/2009/01/30/how-to-export-data-to-excel-from-an-asp-net-application-avoid-the-file-format-differ-prompt.aspx
Etiketler: export to excel
regular expression samples
\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)* email address abc@defg.com
^{3,50}$ at least 3 characters a25
(\d{3} ?)?\d{3} \d{2} \d{2} phone (212) 212 12 12
(\d{4}) 4-digit number 2010
^(\d{1,3}(\,\d{3})*|(\d+))(\.\d{1,2})?$ price 123,456.78
(?=.*\d) must contain at least one numeric character
(?=.*[a-z]) must contain one lowercase character
(?=.*[A-Z]) must contain one uppercase character
.{8,10} From 8 to 10 characters in length
\s allows a space
Etiketler: regular expression
add timer to jquery coda slider
add this code row to coda-slider.js file:
var cycleTimer = setInterval(function (){$scroll.trigger('next')}, 5000);
Etiketler: jquery , jquery slider
failed to retrieve directory listing
solution : c:\windows\system32\inetsrv\inetpub.exe is the file you need to add to your exceptions in Windows Server 2008.
IIS 7.0, FTP 7, and Firewalls
FTP on Windows 2008 Server - Firewall Solution
conflict between asp.net scriptmanager with jquery
solution links :
http://encosia.com/2009/03/25/document-ready-and-pageload-are-not-the-same/
http://api.jquery.com/live/
http://encosia.com/2008/09/28/avoid-this-tricky-conflict-between-aspnet-ajax-and-jquery/
Etiketler: conflict , jquery , SCRIPTMANAGER
unrecognized configuration section connectionstrings
error : Unrecognized configuration section 'connectionStrings'
solution : change the Framework to version 2.0 in IIS (tab of ASP.NET).
Etiketler: iis , iis configuration
linq : left join with linq
var vehicles = (from vehicle in DB.Vehicles
join brand in DB.VehicleBrands on vehicle.BrandId equals brand.Id into data_b from b in data_b.DefaultIfEmpty()
join model in DB.VehicleModels on vehicle.ModelId equals model.Id into data_m from m in data_m.DefaultIfEmpty()
join type in DB.VehicleTypes on vehicle.TypeId equals type.Id into data_t from t in data_t.DefaultIfEmpty()
where
(brandId == null || vehicle.BrandId == brandId) &&
(modelId == null || vehicle.ModelId == modelId) &&
(typeId == null || vehicle.TypeId == typeId) &&
(priceMin == null || vehicle.Price >= priceMin) &&
(priceMax == null || vehicle.Price <= priceMax) &&
vehicle.IsDeleted == false && vehicle.IsActive == true && vehicle.IsSold == false
orderby vehicle.CreateDate descending
select new
{
vehicle.Id,
vehicle.Title,
b.BrandName,
m.ModelName,
vehicle.Price,
vehicle.CreateDate,
vehicle.PhotoPath
});
gvVehicle.DataSource = vehicles;
gvVehicle.DataBind();