Geeks With Blogs

News
Google

Aaron Li's Blog Write it down before I forget February 2008 Entries
SQL Server: Retrieve Top n Records Per Group
My senario: Get latest NumberOfPosts posts for every discussion which meet myCondition SELECT DiscussionTopPosts.PostID From ( SELECT p.DiscussionID, p.PostID, ROW_NUMBER() OVER (PARTITION BY p.DiscussionID ORDER BY p.DateCreated DESC) AS RowNumber FROM Posts p WHERE p.DiscussionID IN ( SELECT d.DiscussionID FROM Discussions d Where myCondition ) AND p.IsActive = 1 GROUP BY p.DiscussionID, p.PostID, p.DateCreated ) DiscussionTopPosts WHERE DiscussionTopPosts.RowNumber <= @NumberOfPosts for more ......

Posted On Thursday, February 21, 2008 5:16 PM

Coding for Different Browsers
--- C# --- string vBrowser = System.Web.HttpContext.Curr... // or string vBrowser = Request.Browser.Browser.ToL... //for local page switch (vBrowser) { case "firefox": do something ... break; case "ie": do something ... break; case "safari": do something ... break; default: do something ... break; } ......

Posted On Wednesday, February 13, 2008 3:50 PM

Find a Control When Multi-level Master Pages are Used
When a page is using a master page, and that master page is using another master page, and so on, then how to find a control on the page? For example, my pages could have three-level master pages. Let's call the third-level master page Master3, which contains a ContentPlaceHolder called PlaceHolder3; Master3's master page is Master2, which contains PlaceHolder2; and Master1, PlaceHolder1. I want to find the panel "pnlTest" on the content page. Here is my function. public bool FindPageControl() { ......

Posted On Wednesday, February 13, 2008 12:33 PM

Copyright © Aaron Li | Powered by: GeeksWithBlogs.net