Thursday, November 26, 2009
Scale out in SQL Server 2005
Tuesday, December 9, 2008
Microsoft provide an open souce CMS
From Microsoft’s description of Oxite:
“Oxite provides you with a strong foundation you can build upon - pingbacks, trackbacks, anonymous or authenticated commenting (with optional moderation), gravatar support, RSS feeds at any page level, support for MetaWebLog API (think Windows Live Writer integration made easy), web admin panel, support for Open Search format allowing users to search your site using their browser’s search box, and more - so, you can spend time on designing a great experience.”
Please go to here for some detail
Sunday, November 30, 2008
Free refactor in Visual Studio
Also, DevExpress provided a free Refactor! for VS 2005. I found it originally from Free refactoring tools for ASP.NET code in Visual Studio 2005. Not sure if it works fine in VS 2008.
Thursday, November 27, 2008
Output GridView to Excel
To output GridView or DataGrid to Excel file, one can use:
- Use oledb classes to create and write data into Excel file
- If datasource is DataTable or DataSet, use writeXml method
- Use RenderControl method of Control class
Taking the latest way as an example
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
htmlWrite.WriteLine("<table cellspacing=\"0\", rules=\"all\", border=\"1\">");
gvResult.RenderControl(htmlWrite);
htmlWrite.WriteLine("</table>");
System.Text.UnicodeEncoding encoding = new System.Text.UnicodeEncoding();
String fileName = Guid.NewGuid().ToString() + ".xls";
String path = @"c:\temp\";
File.WriteAllText(path + fileName, stringWrite.ToString(), encoding);
Data Binding Expression
One can use objects as datasouce and bind to it by using GridView control.
<asp:Label ID="lbNumber" runat="server" Text='<%#Eval("Number") %>'></asp:Label>
Here "Number" is a property of the datasouce object.
If the field of datasouce is a strong typed object itself, we can also use like this:
<asp:Label ID="lbProjectType" runat="server" Text='<%#Eval("ProjectType.Type") %>'></asp:Label>
"ProjectType" is a property of datasouce object and is an object which has a member called "Type".
If we want to do some complex work during binding, we can also do it at code behind. One approach is writing code in RowDataBinding or ItemDataBinding event handler, The other way is define a method and call it declaratively. Below is an example for the later:
<asp:Label ID="lbScheduledDate" runat="server" Text='<%# DisplayDate(Eval("ScheduledFrom"), Eval("ScheduledTo")) %>'></asp:Label>