0

Perform ASP.NET Postback using JQuery

Posted by Tim on October 27, 2011 in .NET Framework, ASP.NET, jQuery

Came across a situation where I needed to disable the ASP.NET button using JQuery when the user clicks on the button, this is so we stop the user from clicking the button twice while the page is doing a postback. Firstly, add the following JQuery/Javascript code: <script>  function autoSubmit()  {  <%= ClientScript.GetPostBackEventReference(btnSaveChanges, "") %>;  } [...]

Tags: , , , ,

 
0

Some useful Extension Methods

Posted by Tim on September 6, 2011 in .NET Framework, C#

Back to basics… A couple of useful Extension methods if you are checking if a string is a valid integer or decimal. public static bool IsInteger(this string value) { if (String.IsNullOrEmpty(value)) return false; Int32 tmpNo; return Int32.TryParse(value, out tmpNo); } public static bool IsDecimal(this string value) { if (String.IsNullOrEmpty(value)) return false; Decimal tmpNo; return Decimal.TryParse(value, [...]

Tags: , ,

 
0

Back to Basics – Deleting Cookies using ASP.NET

Posted by Tim on May 11, 2011 in .NET Framework, ASP.NET

You cannot instruct ASP.NET to physically remove cookies from the user’s computer so you have to tell the user’s browser to modify the cookie in order to trigger the browser to remove the cookie. See code example: HttpCookie aCookie; string cookieName; int limit = Request.Cookies.Count; for (int i=0; i { cookieName = Request.Cookies[i].Name; aCookie = [...]

Tags: ,

 
0

You receive a “The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect” exception when using NVarchar parameters with Sqlclient

Posted by Tim on August 26, 2010 in .NET Framework, SQL Server

The problem I got the following random error: You receive a “The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect” exception when using NVarchar parameters with Sqlclient The Solution Its a known bug with the .Net SqlClient Data Provider.   If you have a field in the database of type nvarchar(max) [...]

Tags: , ,

 
1

Open XML – OLE Automation Date Issues

Posted by Tim on July 26, 2010 in .NET Framework, C#

If you are exporting a date from C# to Excel using 2007, you probably will use the following: Math.Round(DateTime.Now.ToOADate(), 12).ToString() This exports the date as a OLE Automation date recognized by Excel 2007. How ever, in Excel 2010 this was causing issues, every time I exported to Excel 2010, it said that it has to [...]

Tags: , , ,

 
0

Fixing the EF Tracing and Caching Provider Wrapper Issue

Posted by Tim on July 9, 2010 in .NET Framework, C#

If you have been using the Tracing and Caching Provider Wrappers for the ADO.NET Entity Framework 4.0, you might of come across this error message when creating POCO objects, adding them to a Data Context and commiting them to the database using the Caching Wrapper: [NotImplementedException: The method or operation is not implemented.] EFCachingProvider.EFCachingDataReaderCacheWriter.GetName(Int32 ordinal) [...]

Tags: , ,

 
2

Exam 70-536 Part 1 – The journey begins…

Posted by Tim on February 21, 2010 in News

I’m beginning my journey into the world of Microsoft Certification.   Why? The biggest reason is that the company I’m working for encourages professional development so I have taken up the challenge and the opportunity to sit a few Microsoft Exams.   But my biggest reason why is getting one step closer to obtaining a Doctorate in [...]

Tags:

 
0

Could not write lines to file xxx.FileListAttribute.txt Access Denied

Posted by Tim on January 25, 2010 in .NET Framework

Using Visual Studio Team System Edition, you may come across this error when trying to build a solution “Could not write lines to file xxx.FileListAttribute.txt.  Access is denied.” Simple solution..delete the files from the obj directory, reload your solution and attempt to build. Rember: Dont add obj/bin folders to your source safe, and these change [...]

Tags: ,

 
0

Match Whole Words Regular Expressions

Posted by Tim on January 12, 2010 in .NET Framework, Visual Basic

Example: Dim regExp As New Regex(String.Format(“\b{0}\b”, keyword), RegexOptions.IgnoreCase) This is the same as doing the following: note.note_content.StartsWith(InputKeyword &amp; " ") OR _ note.note_content.EndsWith(" " &amp; InputKeyword) OR _ note.note_content.Contains(" " &amp; InputKeyword &amp; " ") References: http://answers.oreilly.com/topic/217-how-to-match-whole-words-with-a-regular-expression/ http://stackoverflow.com/questions/810078/search-for-whole-word-with-linq-to-sql

Tags:

 
0

.NET Comment Tags

Posted by Tim on May 7, 2009 in .NET Framework

Here are some useful tags that can be used when using .NET XML documentation: <seealso>, <summary>, <returns> References: http://msdn.microsoft.com/en-us/library/5ast78ax.aspx

Tags:

Copyright © 2008-2012 Codelab Blog All rights reserved.
Desk Mess Mirrored version 1.9.1 theme from BuyNowShop.com.