|
Sat
Dec 30 2006 |
Disable Infragistics WebGrid |
|
To simulate a disabled grid: Grid.Bands(0).RowStyle.BackColor = Color.LightGray Grid.Bands(0).RowStyle.ForeColor = Color.DarkGray Grid.Bands(0).RowAlternateStyle = Grid.Bands(0).RowStyle Grid.Bands(0).SelectedRowStyle = Grid.Bands(0).RowStyle Grid.Bands(0).HeaderStyle.ForeColor = Color.DarkGray Grid.BackColor = Color.LightGray Grid.DisplayLayout.ClientSideEvents.BeforeSelectChangeHandler = "Grid_BeforeSelectChange" Grid.DisplayLayout.ClientSideEvents.BeforeRowActivateHandler = "Grid_BeforeRowActivate" Add to aspx: <script language="javascript"> // Prevent the user from changing the currently active row function Grid_BeforeRowActivate(gridName, id) { igtbl_cancelPostBack(gridName); return 1; } // Prevent the user from changing the currently selected row function Grid_BeforeSelectChange(gridName, id) { igtbl_cancelPostBack(gridName); return 1; } </script> To restore: Grid.Bands(0).RowStyle = Grid.DisplayLayout.RowStyleDefault Grid.Bands(0).RowAlternateStyle = Grid.DisplayLayout.RowAlternateStyleDefault Grid.Bands(0).SelectedRowStyle = Grid.DisplayLayout.SelectedRowStyleDefault Grid.Bands(0).HeaderStyle = Grid.DisplayLayout.HeaderStyleDefault Grid.BackColor = Color.Transparent Grid.DisplayLayout.ClientSideEvents.BeforeSelectChangeHandler = "" Grid.DisplayLayout.ClientSideEvents.BeforeRowActivateHandler = "" |
|
Tue
Nov 14 2006 |
IE Quick Search |
|
With this tweak you can search Google by type “g searchterms” into the IE address bar. Other shortcuts: gg (Google Groups), ggd (Google Groupe limited to dotnet newgroups), mskb (Microsoft Knowledgebase), wiki (Wikipedia). Save this to a .reg file and double-click. REGEDIT4 [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\SearchUrl] [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\SearchUrl\g] [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\SearchUrl\gg] [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\SearchUrl\ggd] [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\SearchUrl\kb] [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\SearchUrl\mskb] [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\SearchUrl\ms] [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\SearchUrl\wiki] |
|
Fri
Oct 27 2006 |
Redirect Tracing to a File |
<system.diagnostics> <trace autoflush="true" indentsize="4"> <listeners> n <add name="FileListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="TraceLog2.txt" /> </listeners> </trace> </system.diagnostics> |
|
Wed
Oct 25 2006 |
Detect Password Expiry |
|
See the original Usenet posting. public static DateTime PasswordExpirationDate(string user, string domain) { string connect = String.Format("WinNT://{0}/{1},user", domain, user); DirectoryEntry entry = new DirectoryEntry(connect); if (entry == null) Console.WriteLine("Failed to get Directory Entry."); int secondsRemaining = (int)entry.Properties["MaxPasswordAge"][0]; // A policy setting of -1 means no expiration, // so return an 'infinite' date if (secondsRemaining > 0) { secondsRemaining -= (int)entry.Properties["PasswordAge"][0]; return DateTime.Now.AddSeconds(secondsRemaining); } else { return DateTime.MaxValue; } } |
|
Thu
Oct 19 2006 |
Hide property from the Visual Studio Designer |
[Browsable(false), DesignerSerializationVisibility( DesignerSerializationVisibility.Hidden)] |
|
Tue
Oct 17 2006 |
Web Project Errors |
|
When opening a web project:
Create a file called c:\inetpub\wwwroot\Folder\MyProject.csproj.webinfo and add: <VisualStudioUNCWeb> <Web URLPath = "http://localhost/Folder/MyProject.csproj" /> </VisualStudioUNCWeb> |
|
Sat
Oct 14 2006 |
Books to Check out |
|
Agile Principles, Patterns and Practices in C# (Robert C Martin) |
|
Sat
Oct 14 2006 |
.Net Articles |
|
The Cost of GUIDs as Primary Keys |
|
Thu
Oct 5 2006 |
Double.NaN Equality |
Console.WriteLine(double.NaN.Equals(double.NaN)); // True Console.WriteLine(double.NaN == double.NaN); // False |
|
Tue
Sep 19 2006 |
Removing double.NaN from a SQL table |
|
SQL Server’s float datatype does not support the double.NaN value. SQL and T-SQL will prevent these values from entering the database, but ADO.Net does not. Query Analyzer will stop displaying additional results once it hits a NaN value. Enterprise manager will display -1.#IND. Normal queries on this value will result in errors so it is difficult to remove them. The solution: convert to a string first. UPDATE mytable SET floatColumn = NULL WHERE cast(floatColumn AS varchar(100)) = '-1.#IND' |