The Problem
In an N-tier application, you keep your logic in a business logic tier, typically a different VS project that can be used from a website, a windows service, or desktop application, and that should be valid to writ unit tests against on its own.
But how about if your requirements say that you need to to upload some file for the business logic to work? Think of a scanned image (signed contract maybe?) or just a comma separated value file containing some emails. Typically the business logic tier will be the place to to handle this, but how can you send the uploaded file to it? You can get the file as "HttpPostedFile" from the "Request.Files" collection or the file upload control itself, but, to receive it in the business logic, project, the easiest way is to add reference to "System.Web" dll and accept the type "HttpPostedFile" as method argument or so, and when in need to save the file physically, you call the "SaveAs" method of "HttpPostedFile" … So simple right ?
Read the full post ... (2163 words, 3 images, estimated 8:39 mins reading time)
ASP.NET, ASP.NET 2.0, ASP.NET Controls
This is also from an internal mail to SilverKey Tech Egypt office dev. team. Slightly modified this time! (Yes, I know. I should stop this habit of link collection and get back to writing – hopefully soon)
hmm, how about more links as a blog readers bonus,..
Permanent link to this post (183 words, 2 images, estimated 44 secs reading time)
ASP.NET, ASP.NET Controls, Link List, OOP, Patterns
This is a well commented example for a GridView with implementation of RowDataBound and DataBound events. I also demonstrate in it some of the important properties of GridView, like the slight diffrences when dealing with Grid Paging, Rows, Cells, and Columns. I prefered to heavily comment the code than to write separate paragraphs describing it as I do believe that the code is what gets the idea in a direct way.
The example is a simple page that uses SqlDataSource to connect to a SQL Server 2005 Express database and show the results on a GridView with paging capapility. Many parts of the code don’t show the best practices for their situation and those are only included for demonstration purpose as they are not the main focus of the example.
Read the full post ... (1071 words, 5 images, estimated 4:17 mins reading time)
.NET, .NET FAQ, ASP.NET, ASP.NET 2.0, ASP.NET Controls