Sunday, November 14, 2010

Sorting dataview on multiple columns

Sorting multiple columns in the dataview we just need to separate the columns with a comma. To define the sort direction we can use ASC or DESC after the column name. Here is an example on how to sort a dataview in multiple columns
// Get the DefaultViewManager of a DataTable.
DataView view = DataTable1.DefaultView;
// By default, the first column sorted ascending.
view.Sort = "LastName ASC, FirstName ASC, Age DESC";

Monday, November 8, 2010

Implementing Facebook Share

Render the Facebook Share button in an anchor (<a>) tag that takes the following attributes:


1. name: You must specify fb_name for this attribute.
2. type: The type of Share button or link to render, with or without a count included. Specify one of box_count, button_count, button, icon_link, or icon. The box_count and button_count options displays a count of the total number of times the page was shared on Facebook, how many comments were added to the story shared on Facebook, and how many times friends Liked the shared story.
3. If you don't specify a type, then this attribute defaults to button_count.
4. share_url: The URL for the page you want to share. If you don't specify a share_url, then this attribute defaults to the current page.


To put a Facebook Share button on your site right now, copy and paste the following code into the page you want to share:

<a name="fb_share"></a>
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>


Friday, November 5, 2010

MS SQL column properties of a table

SELECT * FROM sys.columns WHERE OBJECT_NAME(OBJECT_ID)=TableName

Example: SELECT * FROM sys.columns WHERE OBJECT_NAME(OBJECT_ID)='Users'

If you want to check if the field name's datatype,max_length,precision,is_nullable you can use the ff: query above and you can see the result below