Saturday, 31 October 2009

C# asp.Net Master Page

In .Net 2.0 and above there are Master pages in asp.Net. Create a master page such as a header and footer that you want across the site and then on the master page add the contentplaceholder tag to mark a point where content will be added to the master page.






Then on the asp web pages for the site add put all the code in content tags setting the contentplaceholderID attribute to the id of the contentplaceholder in the master page.


<asp:content id="Content1" runat="Server" contentplaceholderid="ContentPlaceHolder1">
<span>Hello</span>
</asp:content>


When the browser requests the page the content in the content tag of the asp page will be inserted into the master page at a point according to the contentplaceholder ID. The approach is flexible because it allows for lots of options in the places the data is inserted into the main page. For example you could have two different point in the master file where code was inserted.

Thursday, 22 October 2009

Inner Join

An inner join is when you combine the rows of two tables based on a condition.

select * from customers on pet INNER JOIN customers.id = pet.id

A cross join is the complete data of all the combinations when picking a row from each of the two tables.


Out Join


A left outer Join combines two tables based on a condition. If condition is not met the result from the left table is returned with null entries added for the right table.

select * from customer on pet LEFT OUTER JOIN customers.id = pet.id

A right outer join is the same as left outer join but results from the right hand (second mentioned table in query) are returned

A full outer join combines the results of both left and right outer joins. Duplicate rows are not included.