Thursday, January 21, 2010

wonder if bizspark msdn license can be used for production environment.

The answer is YES.


Find out more from here in appendix A

Wednesday, January 20, 2010

Error : Sequence contains no elements when you execute query that return null

In this statement if Trans.param1== param1Value returns nothing, you will hit the error above.

Class1 objClass1 = _db.Class1.First(Trans => Trans.param1== param1Value);

To prevent this, you need to use 'FirstOrDefault' instead

Class1 objClass1 = _db.Class1.FirstOrDefault(Trans => Trans.param1== param1Value);

How to pass Guid variable to ObjectDataSource ?

I Spent one day to find out how to pass guid variable to objectDataSource, the error encoutered is

"Object must implement IConvertible"

The solution for this is to use


"< name="myGuid">" instead of

"< name="myGuid" type="String">"

Find out more from here

Friday, January 15, 2010

ashx

Just discover what is ashx in asp.net, it is nothing but the httphandler that we used in MOSS.

Creating a new ashx, is actually creating a class that inherit from IHttpHandler. Instead of loading xml from page load event in typical asp.net web form, ashx could be the best option for you to do the same tasks.

Example,


public void ProcessRequest (HttpContext context)
{
context.Response.ContentType = "text/xml";
context.Response.ContentEncoding = System.Text.Encoding.UTF8;

string sXml = BuildXMLString(); //not showing this function,
//but it creates the XML string

context.Response.Cache.SetExpires(DateTime.Now.AddSeconds(600));
context.Response.Cache.SetCacheability(HttpCacheability.Public);
context.Response.Write( sXml );
}

Thursday, January 14, 2010

jquery + VS 2008 SP1

Ever wonder how to enable jquery intelliSense in VS 2008 ? very simple.

0. VS SP1 is installed
1. Download the KB946581 from here
2. Download jquery from here and documentation from here
3. Install the KB

This is it, very simple. The next question is why jquery, checkout this post on how to call .net webservice using jquery


Useful resources

Download for Visual Studio 2008 SP1

Download for .net 3.5 SP1

How to perform autoComplete