Share This!

Thursday, March 22, 2012

Sorting a non-SQL Dataset

So I have an ASP.NET web site and the data is coming not from a SQL Server database, but from a web service.  I have executed the Web call and gathered the data into a dataset, and I wish to sort the data inversely by job order number, floating the newest job orders to the top.

As it turns out, there is no Dataset.Sort command, but there is this.

DataRow[] SortedRows = JobsDataTable.Select("isOpen = 1", "jobOrderID desc");

This gives back a sorted (and also filtered) array of DataRows based on the criteria you use. 

Now, you can't databind to a DataRow array, but if you are using databinding, the DataGrid or DataGridView can filter and sort for you, so you wouldn't need to use this technique.



Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Saturday, March 17, 2012

Making an Image into a Usable Web Background.

 Ok, you have this great image and you want to make it the backdrop for your company web page.  Let's pick this one.
Photo of a building.
Beautiful.  But look what happens when you use it as a web backdrop.

OMG you can't read a thing!  So let's try playing with the contrast...

brightness+contrast
 Not this!  It's washed out all the details!  Maybe the levels...
 Closer, but there must be a better way.  And there is!  The problem is that we're thinking like engineers and not artists.  Try this.

Add a layer of White over the top of the image.  Then set the transparency of that layer to about 85%  This trick also works for dark backgrounds, just fill the new layer with black.



...

Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Friday, March 16, 2012

C#.NET Finding the First Day of the Week in One Line of Code

while (myDate.DayOfWeek != DayOfWeek.Sunday) { myDate = myDate.AddDays(-1); }


Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.