none
Consume Rest Wcf Service in Client side in asp.net C# RRS feed

  • Question

  • Hi ,

         I have created the Rest wcf service which have :

    Service.cs:

    public List<BoSectionList> GetSectionDetail(string SectionId)
            {        
                return SectionListDAL.GetSectionDetail(SectionId);
            }

    Interface.cs:

    [OperationContract]
            [WebInvoke(Method = "GET",
               ResponseFormat = WebMessageFormat.Xml,
               BodyStyle = WebMessageBodyStyle.Wrapped,
               UriTemplate = "GetlDetail/SectionId/{SectionId}")]
            List<BoSectionList> GetSectionDetail(string SectionId)

    DataAccess.cs:

     public static List<BoSectionList> GetSectionDetail( string SectionId)
            {
                List<BoSectionList> oCCSectionDetail = new List<BoSectionList>();
                IDataReader oReader = ((new Linx2DB()).RED_GetSectionDetail(SectionId).ExecuteReader());
                if (oReader == null)
                    return null;
                while (oReader.Read())
                {
                    BoSectionList oCCSectionDetails = new BoSectionList();
                    oCCSectionDetails.SectionId = oReader[DbColumnName.SectionId].ToString();
                    oCCSectionDetails.SectionNumber = oReader[DbColumnName.SectionNumber].ToString();
                    oCCSectionDetails.DisplayTitle = oReader[DbColumnName.DisplayTitle].ToString();
                    oCCSectionDetails.Status = oReader[DbColumnName.Status].ToString();
                    oCCSectionDetail.Add(oCCSectionDetails);
                }
                oReader.Close();
                return oCCSectionDetail;

            }

    I want Consume the Rest Service:http://localhost:61258/SectionList.svc/GetlDetail/SectionId/2de80f28-8f3b-4a76-bc02-8186e681efd3

    in Client Side. which is return the list

    how can consume the this service in client side and populate the data in gridview please suggest me.


    Ashish

    • Moved by Lisa Zhu Friday, February 15, 2013 9:13 AM wcf related
    Thursday, February 14, 2013 1:11 PM

Answers

  • Ashish,

    If you want it on the client-side you need to use JavaScript.

    JQuery is JavaScript.   Microsft Visual Studio (the latest version) will put the JQuery libraries in your website by default.  So, you would be using the tools that Microsoft is suggesting you use for this purpose.

    Friday, February 15, 2013 1:20 PM

All replies