Alec Tang

Professional Web Developer/ Web Designer

I build websites based on the latest web standards providing the best possible solution to your company

  • Home
  • About
  • Portfolio
  • Contact
  • Blog
All Posts under ASP.NET C# Subscribe our RSS Feed Subscribe Feed
  • Sys.WebForms.PageRequestManagerParserErrorException

    Blog post about Sys.WebForms.PageRequestManagerParserErrorExceptionI had the problem of page not able to redirect when in an ajax postback. It happens to be the fact that I disabled a line in web.config:. This line should be added in HttpModules, so that redirection will work in Ajax postback. This class manages HttpModules for Ajax functionalities in ASP.NET.

    Read on... Posted by: Alec On Wednesday, 12 May 2010 - in
    • ASP.NET C#
    • Sharepoint
  • How to send email via Sharepoint

    Blog post about How to send email via SharepointA useful function to send email in Sharepoint, programatically.

    Read on... Posted by: Alec On Tuesday, 30 March 2010 - in
    • ASP.NET C#
    • Sharepoint
  • How to retrieve and update from a multi choice Checkboxlist field

    Blog post about How to retrieve and update from a multi choice Checkboxlist fieldThis post shows you how to retrieve a checkboxlist from a multi choice field as well as how to update the field using SPFieldMultiChoiceValue.

    Read on... Posted by: Alec On Monday, 15 March 2010 - in
    • ASP.NET C#
    • Sharepoint
  • Auto Complete returns giant list of undefined

    Blog post about Auto Complete returns giant list of undefinedAaron was creating a custom web service to be used by web parts in Sharepoint, but then there was a problem of a giant list of "undefined" values returning. Done a lot of research and later this brilliant post directed us to the right place.

    Read on... Posted by: Alec On Monday, 08 March 2010 - in
    • ASP.NET C#
    • Sharepoint
  • Integrate Ajax Control Toolkit into Sharepoint

    Blog post about Integrate Ajax Control Toolkit into SharepointI wanted to use Ajax control toolkit in Sharepoint, and had not had any luck until I spent the whole day debugging and getting it to work. I already had Ajax integrated in Sharepoint, so it should be fairly easy to just add in AjaxControlToolkit, but the problem is the latest version of it actually requires you to use ToolkitScriptManager instead of ScriptManager, otherwise your control will not work and you will see a Javascript error of "Please wait while scripts are loaded".

    Read on... Posted by: Alec On Friday, 12 February 2010 - in
    • ASP.NET C#
    • Sharepoint
  • Dynamically assign task to user in Sharepoint

    Blog post about Dynamically assign task to user in SharepointI had to create a task dynamically in C# and assign the task to a reviewer, which is a user account. However, there was this problem of the "Assigned to" field is only read only. To do that, just create an SPFieldUserValueCollection and assign it to task item.

    Read on... Posted by: Alec On Thursday, 04 February 2010 - in
    • ASP.NET C#
    • Sharepoint
  • Getting SPUser from SPQuery programmatically

    Blog post about Getting SPUser from SPQuery programmaticallyI needed to get SPUser object from doing a lookup using CAML query, so that I could get the user information such as email address, etc. To do that, this is the code that I used:

    Read on... Posted by: Alec On Wednesday, 03 February 2010 - in
    • ASP.NET C#
    • Sharepoint
  • Debug not working for Sharepoint

    Blog post about Debug not working for SharepointI had the problem of not able to debug Sharepoint in Visual Studio 2008 awhile ago, and glad that Aaron shown me how to do it by doing some tricks. What happened was the PDB file might not have been deployed to the assembly GAC.

    Read on... Posted by: Alec On Tuesday, 02 February 2010 - in
    • ASP.NET C#
    • Sharepoint
  • ScriptResource.axd from Ajax getting Too Big

    Blog post about ScriptResource.axd from Ajax getting Too BigToday I was testing the loading time of my site, which I sometimes find it slow to access especially the first time loading. I knew there are a lot of images to be loaded especially those in portfolio sections but I also found that the biggest loading item seems to be ScriptResource.axd from Ajax. It was 330kb!

    Read on... Posted by: Alec On Thursday, 21 January 2010 - in
    • ASP.NET C#
    • SEO
  • Reading and Writing to Lookup Field in Sharepoint

    Blog post about Reading and Writing to Lookup Field in SharepointLookup field is a field which links a child class to a parent class, it is an association kind, which allows a list item to reference another item from another list. However, reading and writing to a lookup field is different from a normal field. We need to use the class SPFieldLookupValue to archieve this.

    Read on... Posted by: Alec On Monday, 18 January 2010 - in
    • ASP.NET C#
    • Sharepoint
  • Creating Update Panel in Code Behind Dynamically

    Blog post about Creating Update Panel in Code Behind DynamicallyCreating Update Panel in code behind dynamically can be a bit tricky, comparing to doing it at the front end. Here's a quick view of the code we write to do this.

    Read on... Posted by: Alec On Monday, 18 January 2010 - in
    • ASP.NET C#
  • Setting up a core framework for Sharepoint Webpart

    Blog post about Setting up a core framework for Sharepoint WebpartI was trying to create a web part with WSPBuilder installed on Visual Studio 2008, but had the problem of rendering a user control. Then I came across this blog post, which explains the steps in wrapping usercontrol with WSPBuilder solution. What's even greater is we can setup a structure which seperates the application presentation layer with the WSP project.

    Read on... Posted by: Alec On Wednesday, 13 January 2010 - in
    • ASP.NET C#
    • Sharepoint
    • Tools
  • Integrating Ajax into Sharepoint 2007

    Blog post about Integrating Ajax into Sharepoint 2007Recently, I had the chance to play around with ajaxifying Sharepoint server. As you would have probably known, Ajax is a great feature in .NET 3.5 but MOSS 2007 was shipped before Ajax was out. So, to use it, we just need some configurations done.

    Read on... Posted by: Alec On Tuesday, 05 January 2010 - in
    • ASP.NET C#
    • Sharepoint
  • How to Sort and Filter Generic List of Object using LINQ

    Blog post about How to Sort and Filter Generic List of Object using LINQOne of the best things of using LINQ is how easy we could sort or filter objects with a line of code. Consider we have a generic list of object of Employees and we want to filter them with their age. Using LINQ, we don't have to connect to the data source and get the SQL to do the where query. We can just do something like this...

    Read on... Posted by: Alec On Thursday, 17 September 2009 - in
    • ASP.NET C#
    • LINQ
  • Making sure Lightbox still works in Ajax UpdatePanel

    Blog post about Making sure Lightbox still works in Ajax UpdatePanelI recently updated the homepage portfolio section with an Ajax filtering dropdown, allowing readers to filter my portfolio with different technologies and themes. However, that caused my old lightbox effect to lose ground somehow. After days of debugging, I found a way to deal with it, that is...

    Read on... Posted by: Alec On Thursday, 17 September 2009 - in
    • ASP.NET C#
    • JavaScripts
  • Setting Default Button for Textbox Upon Hitting Enter

    Blog post about Setting Default Button for Textbox Upon Hitting EnterThis has to be pretty simple, but I never actually realised it. That is, when we have a textbox, and a button aside, and we want to enter text into the textbox and do a postback by hitting enter on our keyboard instead of hitting the button aside. This can easily be done by wrapping the controls inside a panel, and then set the defaultButton property to the button's id. Gee, I never knew that...

    Read on... Posted by: Alec On Tuesday, 15 September 2009 - in
    • ASP.NET C#
  • How to show DateTime as Time Left

    Blog post about How to show DateTime as Time LeftI recently needed to show a datetime as amount of time left or past. This can be done by using TimeSpan, which you can get by subtracting one DateTime from another...

    Read on... Posted by: Alec On Tuesday, 08 September 2009 - in
    • ASP.NET C#
  • Using StringBuilder to improve performance

    Blog post about Using StringBuilder to improve performanceJorge pointed out the other day that when we do a lot of string concatenation, it is better to use StringBuilder instead of the String class (e.g. str += "something more"; ). This is because StringBuilder gives a better performance when in memory than the standard String class, which requires garbage collection to remove.

    Read on... Posted by: Alec On Friday, 04 September 2009 - in
    • ASP.NET C#
  • How to connect ASP.NET application to use MySQL

    Blog post about How to connect ASP.NET application to use MySQLA very easy way to connect ASP.NET application to use MySQL database is to use the MySQL Net Connector. With just the following lines of code, you can easily hookup your ASP.NET application to any MySQL db.

    Read on... Posted by: Alec On Tuesday, 01 September 2009 - in
    • ASP.NET C#
  • How to solve unique group name for radio buttons

    Blog post about How to solve unique group name for radio buttonsWhen using radio button in a repeater item template, there's a problem of grouping them to a unique name. Solution can be found: http://www.developer.com/net/asp/article.php/3623096

    Read on... Posted by: Alec On Tuesday, 25 August 2009 - in
    • ASP.NET C#
  • How to create Gradient effect background using C#

    Blog post about How to create Gradient effect background using C#Ever wanted to create a gradient image dynamically? This can easily be done using C# with the following snipplet of code. We can also specify the width, height, gradient direction (horizontal or vertical), and the two colors. By using LinearGradientMode class, a beautiful gradient image can be drawn in a sec.

    Read on... Posted by: Alec On Monday, 10 August 2009 - in
    • ASP.NET C#
  • Creating a XML based Dynamic Sitemap

    Blog post about Creating a XML based Dynamic Sitemap Having a working sitemap in an ASP.NET application can't be anymore important. You can use it for navigations, breadcrumbs, etc. The default web.sitemap file is an XML file which provides the root node of the site, the SiteMapProvider used, and tracks the provider objects. System.Web.SiteMap inherits from System.Object. The default provider XMLSiteMapProvider works through the Web.sitemap. Besides being useful for site navigation, the sitemap also provides a easy way for search engines to look for pages on the site.

    Read on... Posted by: Alec On Wednesday, 15 July 2009 - in
    • ASP.NET C#
  • How to call parent and get data from usercontrol

    Blog post about How to call parent and get data from usercontrolUserControls are great, particularly in making the code more eye friendly, seperating big bunch of codes into different parts and be able to re-use them throughout the application. However, there are times when we need to reference something in the parent page or control from the usercontrol level. That's when I had an issue today, and finally solved it using the brilliant delegate.

    Read on... Posted by: Alec On Tuesday, 16 June 2009 - in
    • ASP.NET C#
  • Regular Expression for validating Australian phone numbers

    Blog post about Regular Expression for validating Australian phone numbersA very useful regular expression for validation Australian wide phone number, including mobile phones. This would accepts all forms of Australian phone numbers in different formats (area code in brackets, no area code, spaces between 2-3 and 6-7th digits, +61 international dialing code).

    Read on... Posted by: Alec On Monday, 11 May 2009 - in
    • ASP.NET C#
  • Compress WebResource.axd in Client side HTML

    Blog post about Compress WebResource.axd in Client side HTMLA very handy tool to compress the annoying webresources.axd script. http://madskristensen.net/post/Compress-WebResourceaxd-in-ASPNET.aspx

    Read on... Posted by: Alec On Thursday, 16 April 2009 - in
    • ASP.NET C#
    • Tools
  • Use Enterprise Library for Data Access in one line code

    Blog post about Use Enterprise Library for Data Access in one line codeEnterprise Library is a very useful component developed by Microsoft to help developers solving many common tasks. One that I use a lot is the data access block, which allows you to run data access query in just one line of code! (Saves all the work in writing a command and pass to a reader, etc).

    Read on... Posted by: Alec On Wednesday, 15 April 2009 - in
    • ASP.NET C#
    • Tools
  • Object references between two different object scopes are not allowed

    Blog post about Object references between two different object scopes are not allowedWhen using ORM, should always keep in mind that only one object scope is used. The example came with the package doesn't really explain this well. Should always declare a page_init call which declares the object scope and store it in session and try to keep using it for any business operations:

    Read on... Posted by: Alec On Tuesday, 07 April 2009 - in
    • ASP.NET C#
    • Telerik
  • Convert DataSet to XMLDocument

    Blog post about Convert DataSet to XMLDocumentHow to convert data to xml file? Here is a very useful command to convert dataset or datatable to an XML Document:

    Read on... Posted by: Alec On Tuesday, 07 April 2009 - in
    • ASP.NET C#
  • How to check if a method is overridable

    Blog post about How to check if a method is overridableFor a method or properties to be overridable, it must has a virtual property in its base class set as true as well, is final must be set as true. To determine whether a method is overridable, it is not sufficient to check that IsVirtual is true.

    Read on... Posted by: Alec On Thursday, 02 April 2009 - in
    • ASP.NET C#
  • Security Exception when running on IIS7

    Blog post about Security Exception when running on IIS7I stumbled upon an error when deploying a web application onto IIS7 running on Vista. After days of trying to solve, it's actually due to the fact that the application is set to medium trust but it actually needs Full Trust due to using Reflection in the code.

    Read on... Posted by: Alec On Wednesday, 01 April 2009 - in
    • ASP.NET C#
  • Telerik: ORM - Using Generic Method to Add New Object

    Blog post about Telerik: ORM - Using Generic Method to Add New ObjectWhen using ORM, after we have setup the business objects, it's useful if we create some generic methods which can be used in many places.

    Read on... Posted by: Alec On Friday, 06 March 2009 - in
    • ASP.NET C#
    • Telerik
  • Using Generic Method for Standard Add/ Delete in ORM

    Blog post about Using Generic Method for Standard Add/ Delete in ORMTelerik ORM (Open Access Mapping) has been a very useful tool, for mapping database structures into object oriented classes, so called Persistent Classes. This saves a lot of efforts in writing up these classes manually. What's more we could add on to it is to use generic methods on standard adding and deleting transaction.

    Read on... Posted by: Alec On Monday, 02 March 2009 - in
    • ASP.NET C#
    • LINQ
    • Telerik
  • Login Form Authentication with Multiple Web.Configs

    Blog post about Login Form Authentication with Multiple Web.ConfigsApplying security for a web application is a very common task. There are always parts on a web site that requires private only access for members. Recently, I tried to use the form authentication method provided by .NET and found it quite simple to use, though I have always done it with sessions. The

    Read on... Posted by: Alec On Saturday, 28 February 2009 - in
    • ASP.NET C#

Search

 

Latest Posts

  • Sys.WebForms.PageRequestManagerParserErrorException
  • How Google treats Content Duplication
  • How to create HTML column in Sharepoint List View
  • How Sharepoint stores User Data
  • How to send email via Sharepoint
  • Malaysia Airlines launched iPhone Application: MHMobile
  • Intranet, the next big market
  • How to retrieve and update from a multi choice Checkboxlist ...
  • Auto Complete returns giant list of undefined
  • Integrate Ajax Control Toolkit into Sharepoint

Categories

  • Browsers (1)
  • Projects (1)
  • Web Design (6)
  • Sharepoint (20)
  • Telerik (5)
  • Wordpress (1)
  • Internet (1)
  • SQL (5)
  • LINQ (3)
  • ASP.NET C# (33)
  • JavaScripts (3)
  • IIS (0)
  • Industry (1)
  • Tools (8)
  • SEO (4)

Archives

  • May 2010 (1)
  • April 2010 (3)
  • March 2010 (5)
  • February 2010 (4)
  • January 2010 (11)
  • November 2009 (3)
  • October 2009 (1)
  • September 2009 (9)
  • August 2009 (3)
  • July 2009 (4)
  • June 2009 (1)
  • May 2009 (2)
  • April 2009 (8)
  • March 2009 (6)
  • February 2009 (2)
© Copyright 2009 Alec Tang. All Rights Reserved.
This site is conform to W3C Standard XHTML & CSS