http://devtoolshed.com/content/find-control-templatefield-programmatically
can't use:
Label labCompany = (Label) DetailsView1.FindControl("LabelCompany");
this will not find the LabelCompany control because it is a child control of the DetailsView1 ... therefore, labCompany is not bound to anything ...
need to use a recursive function to loop through the layers of controls within a control such as DetailsView1
Friday, February 1, 2013
Thursday, January 31, 2013
dynamic linq queries
http://weblogs.asp.net/scottgu/archive/2008/01/07/dynamic-linq-part-1-using-the-linq-dynamic-query-library.aspx
- copy dynamic.cs into /App_code folder (get this file from: http://msdn.microsoft.com/en-us/vstudio//bb894665.aspx)
- insert top of code page: Using System.Linq.Dynamic;
- copy dynamic.cs into /App_code folder (get this file from: http://msdn.microsoft.com/en-us/vstudio//bb894665.aspx)
- insert top of code page: Using System.Linq.Dynamic;
Wednesday, January 30, 2013
sql server database backup + restore
Backup database:
USE DatabaseName
GO
BACKUP DATABASE DatabaseName
TO DISK = 'C:\dataFolder\db9-18-12.Bak'
GO
1
Copy the .bak file onto the local computer into c:\dataFolder\
Open SMS on the local computer
Run this query to replace the existing database
(* this is basic migration. This will drop existing database and replace. If
appending data or something else, need to modify the query) – If the database
doesn’t exist, remove the REPLACE clause (remove prior “,” also) and the new
database will be created from the backup.
Restore or create new DB:
USE MASTER
GO
RESTORE DATABASE JONDO
FROM DISK = 'C:\dataFolder\db9-18-12.Bak'
WITH
REPLACE
GO
Monday, November 12, 2012
Exif metadata and image orientation
Nice c# program to read exif metadata from image files.
http://www.codeproject.com/Articles/11305/EXIFextractor-library-to-extract-EXIF-information
Good article to explain image orientation data values.
http://www.impulseadventure.com/photo/exif-orientation.html
Website to get metadata and see the data
http://support.persits.com/jpeg/demo_metadata.asp
http://www.codeproject.com/Articles/11305/EXIFextractor-library-to-extract-EXIF-information
Good article to explain image orientation data values.
http://www.impulseadventure.com/photo/exif-orientation.html
Website to get metadata and see the data
http://support.persits.com/jpeg/demo_metadata.asp
Friday, October 26, 2012
Javascript - Get filesize client side
See http://www.w3.org/TR/FileAPI/.
var fi = document.getElementById('fileInput');
alert(fi.files[0].size);
*****
Complete example:
http://stackoverflow.com/questions/3717793/javascript-file-upload-size-validation
Be sure to always perform a server side check as well. The client side check is more
of a convenience function for the user rather than letting them upload a 5 mb file only
to then be notified by the server that it is too large.
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-type" content="text/html;charset=UTF-8"> <title>Show File Data</title> <style type='text/css'> body { font-family: sans-serif; } </style> <script type='text/javascript'> function showFileSize() { var input, file; // (Can't use `typeof FileReader === "function"` because apparently // it comes back as "object" on some browsers. So just see if it's there // at all.) if (!window.FileReader) { bodyAppend("p", "The file API isn't supported on this browser yet."); return; } input = document.getElementById('fileinput'); if (!input) { bodyAppend("p", "Um, couldn't find the fileinput element."); } else if (!input.files) { bodyAppend("p", "This browser doesn't seem to support the `files` property of file inputs."); } else if (!input.files[0]) { bodyAppend("p", "Please select a file before clicking 'Load'"); } else { file = input.files[0]; bodyAppend("p", "File " + file.name + " is " + file.size + " bytes in size"); } } function bodyAppend(tagName, innerHTML) { var elm; elm = document.createElement(tagName); elm.innerHTML = innerHTML; document.body.appendChild(elm); } </script> </head> <body> <form action='#' onsubmit="return false;"> <input type='file' id='fileinput'> <input type='button' id='btnLoad' value='Load' onclick='showFileSize();'> </form> </body> </html>
Tuesday, October 16, 2012
File Upload with progress bar
AJAX toolkit has two controls: AsyncFileUpload (multiple files w/ progress bar) and AjaxFileUpload (single file)
http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/AsyncFileUpload/AsyncFileUpload.aspx
Here's a File Upload with progress bar
http://www.codeproject.com/Articles/113418/ASP-NET-File-Upload-with-Progress-Bar
Here's a way to change the presentation (e.g., change button image) using jQuery
http://www.appelsiini.net/projects/filestyle
http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/AsyncFileUpload/AsyncFileUpload.aspx
Here's a File Upload with progress bar
http://www.codeproject.com/Articles/113418/ASP-NET-File-Upload-with-Progress-Bar
Here's a way to change the presentation (e.g., change button image) using jQuery
http://www.appelsiini.net/projects/filestyle
Tuesday, October 2, 2012
Subscribe to:
Posts (Atom)