Basic Usage

2 posts, 0 answers
  1. SANJAY
    SANJAY avatar
    61 posts
    Member since:
    Jun 2012

    Posted 22 Jun 2014 Link to this post

    I have a webapi running on http://services.thetaskmate.in/api/ImageGallery/aa

    When I run the api in webbrowser I get desired result
    I have checked the api in Fiddler and I get json data

    When I execute your example page
          <telerik:RadImageGallery runat="server" ID="RadImageGallery1" Height="600px" Width="800px"
            ClientDataSourceID="RadClientDataSource1"
            DataImageField="ImageUrl" DataThumbnailField="ThumbUrl" DataTitleField="Title">
            <ClientSettings>
                <AnimationSettings>
                    <NextImagesAnimation Type="VerticalSlide" />
                    <PrevImagesAnimation Type="VerticalSlide" />
                </AnimationSettings>
            </ClientSettings>
        </telerik:RadImageGallery>

        <telerik:RadClientDataSource runat="server" ID="RadClientDataSource1"  >
            <DataSource>
                <WebServiceDataSourceSettings BaseUrl ="http://services.thetaskmate.in/api/ImageGallery/aa" >
                    <Select Url="http://services.thetaskmate.in/api/ImageGallery/aa"  RequestType="Get"  DataType="JSON"   />
                </WebServiceDataSourceSettings>
            </DataSource>
            <Schema DataName="D" >
                 <Model>
                    <telerik:ClientDataSourceModelField FieldName="ImageUrl" DataType="String" />
                    <telerik:ClientDataSourceModelField FieldName="ThumbUrl" DataType="String" />
                    <telerik:ClientDataSourceModelField FieldName="Title" DataType="String" />
                     <telerik:ClientDataSourceModelField FieldName="Description" DataType="String" />
                </Model>
            </Schema>
            <ClientEvents  OnRequestFailed="tst"  OnRequestStart="b" OnDataParse="c" />
        </telerik:RadClientDataSource>

    <script type="text/javascript">
        function tst(){
            alert("a");
        }
        function b() {
            alert("b");
        }
        function c() {
            alert("data");
        }
    </script>

    I get a RequestFailed.

  2. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 25 Jun 2014 Link to this post

    Hi Sanjay,

    Your settings are incorrect:
    <telerik:RadClientDataSource runat="server" ID="RadClientDataSource1">
              <DataSource>
                  <WebServiceDataSourceSettings BaseUrl="http://services.thetaskmate.in/api/ImageGallery/">
                      <Select Url="aa" RequestType="Get" DataType="JSON" />
                  </WebServiceDataSourceSettings>
              </DataSource>

    But at the moment your web api controller blocks cross domain requests.
    I'm getting the following error when I call it:

    Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://services.thetaskmate.in/api/ImageGallery/aa. This can be fixed by moving the resource to the same domain or enabling CORS.

    Regards,
    Hristo Valyavicharski
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top