thanks to the author,
http://avinashkt.blogspot.com/2009/05/programmatically-export-records-from.html
here is the trick
string spListName = "CartDetails";
            SPList oList = SPContext.Current.Web.Lists[spListName]; 
            string listGUID = oList.ID.ToString().ToUpper().Replace("-", "\u00252D");
            string viewGUID = oList.DefaultView.ID.ToString().ToUpper().Replace("-", "\u00252D");            
            strCommand = "javascript:EnsureSSImporter();" + 
                "javaScript:ExportList('\u002f_vti_bin\u002fowssvr.dll?CS=65001\u0026" 
                + "Using=_layouts\u002fquery.iqy\u0026" + "List=\u00257B" 
                + listGUID + "\u00257D\u0026" + "View=\u00257B" + viewGUID
                + "\u00257D\u0026" + "RootFolder=\u00252FLists\u00252F" 
                + spListName.Replace("_", "\u00255F") + "\u0026" + "CacheControl=1')";
            btnExportToExcel.Attributes.Add("onclick", strCommand+"; return false;");
Friday, March 18, 2011
Thursday, March 10, 2011
SharePoint SPMetal + CreatedBy, Created
string _CreatedBy;
[Microsoft.SharePoint.Linq.ColumnAttribute(Name = "Author", Storage = "_CreatedBy", ReadOnly = true, FieldType = "User", IsLookupValue = true)]
public string CreatedBy { get { return this._CreatedBy; } set { if ((value != this._CreatedBy)) { this.OnPropertyChanging("CreatedBy", this._CreatedBy); this._CreatedBy = value; this.OnPropertyChanged("CreatedBy"); } } }
DateTime _Created;
[Microsoft.SharePoint.Linq.ColumnAttribute(Name = "Created", Storage = "_Created", ReadOnly = true, FieldType = "DateTime", IsLookupValue = false)]
public DateTime Created { get { return this._Created; } set { if ((value != this._Created)) { this.OnPropertyChanging("Created", this._Created); this._Created = value; this.OnPropertyChanged("Created"); } } }
1 Name="Editor" Member="ModifiedBy"
2 Name="Author" Member="CreatedBy"
3 Name="Created"
4 Name="Modified"
[Microsoft.SharePoint.Linq.ColumnAttribute(Name = "Author", Storage = "_CreatedBy", ReadOnly = true, FieldType = "User", IsLookupValue = true)]
public string CreatedBy { get { return this._CreatedBy; } set { if ((value != this._CreatedBy)) { this.OnPropertyChanging("CreatedBy", this._CreatedBy); this._CreatedBy = value; this.OnPropertyChanged("CreatedBy"); } } }
DateTime _Created;
[Microsoft.SharePoint.Linq.ColumnAttribute(Name = "Created", Storage = "_Created", ReadOnly = true, FieldType = "DateTime", IsLookupValue = false)]
public DateTime Created { get { return this._Created; } set { if ((value != this._Created)) { this.OnPropertyChanging("Created", this._Created); this._Created = value; this.OnPropertyChanged("Created"); } } }
1 Name="Editor" Member="ModifiedBy"
2 Name="Author" Member="CreatedBy"
3 Name="Created"
4 Name="Modified"
Monday, March 7, 2011
javascript convert number to currency . ex:- 1234.56, 1234.00
Thanks to the author, I missed the original link
function CurrencyFormatted(amount) {
var i = parseFloat(amount);
if (isNaN(i)) { i = 0.00; }
var minus = '';
if (i < 0) { minus = '-'; }
i = Math.abs(i);
i = parseInt((i + .005) * 100);
i = i / 100;
s = new String(i);
if (s.indexOf('.') < 0) { s += '.00'; }
if (s.indexOf('.') == (s.length - 2)) { s += '0'; }
s = minus + s;
return s;
}
function CurrencyFormatted(amount) {
var i = parseFloat(amount);
if (isNaN(i)) { i = 0.00; }
var minus = '';
if (i < 0) { minus = '-'; }
i = Math.abs(i);
i = parseInt((i + .005) * 100);
i = i / 100;
s = new String(i);
if (s.indexOf('.') < 0) { s += '.00'; }
if (s.indexOf('.') == (s.length - 2)) { s += '0'; }
s = minus + s;
return s;
}
asp.net gridview, column total in footer using java script
Thanks to the author @  http://forums.asp.net/t/1168003.aspx
--------------------
In my grid I have one label in template field which stores item price, I want to show the total of items on label in footer.
function RetrievePackageDetailInputs() {
try {
var totVal = 0;
rows = document.getElementById('<%= gvCartDetails.ClientID %>').getElementsByTagName("TR");
for (var j = 1; j < rows.length - 1; j++) { cells = rows[j].getElementsByTagName("span"); if (cells.length > 0) {
totVal = Number(totVal) + Number(cells[0].innerHTML);
}
}
rows[rows.length - 1].getElementsByTagName("span")[0].innerHTML =CurrencyFormatted(totVal);
}
catch (er) {
// Non-critical error
alert(er.description);
}
}
--------------------
In my grid I have one label in template field which stores item price, I want to show the total of items on label in footer.
function RetrievePackageDetailInputs() {
try {
var totVal = 0;
rows = document.getElementById('<%= gvCartDetails.ClientID %>').getElementsByTagName("TR");
for (var j = 1; j < rows.length - 1; j++) { cells = rows[j].getElementsByTagName("span"); if (cells.length > 0) {
totVal = Number(totVal) + Number(cells[0].innerHTML);
}
}
rows[rows.length - 1].getElementsByTagName("span")[0].innerHTML =CurrencyFormatted(totVal);
}
catch (er) {
// Non-critical error
alert(er.description);
}
}
Subscribe to:
Comments (Atom)
