Tuesday, January 13, 2009

JqGrid with WCF REST Service

We have WCF services implemented for thick and thin clients. But as the dynamicity increased we started to wrap those services around REST based WCF Services majorly for Web Client. Now am slowly getting rid of any ASP.Net code written at client. I know its pretty mean of me, but I don’t feel the sense to do it.

I am waiting for ASP.Net MVC to be integrated nicely in VS and then probably think of something in ASP.Net. There might be a situation where in we have client totally independent of any web technology :) That will be powerful for sure. Future is WCF Services and client rich applications that how I look at it. 

I started to implement my Services with jqGrid yesterday and could complete the services part and Client Grid in hours but it took time to integrate it all and see my data rendering in Grid. I won’t blame on poor documentation of jqGrid but yeah it took 6-7 hours for me to implement the same. I can't whine now cuz its working and working fine now. I found no place where this combo was even attempted. So wanted to contribute for the community as well...

I will upload the whole solution after some cosmetic improvements. If someone needs any help, post comments.

Script Code -------------------------------


HTML-------------------------------------------------------

    


    


REST Service -----------------------------------------------

 [ServiceContract(Name = "CandidateService", Namespace = "JsonCandidateService")]  

    public interface IJSONCandidateService

    {

        [OperationContract]

        [WebInvoke(Method = "GET",

                 ResponseFormat = WebMessageFormat.Json,

                 BodyStyle = WebMessageBodyStyle.Bare,

               UriTemplate = "Candidates/{criteria}"

        )]

        JQGridCandidatesResponse GetAllCandidates(string criteria);

    }

Thats it for now, shall upoad the full solution soon. Happy jQuerying :)

No comments: