Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
70 views
Telerik RadCombobox OnClientTemplateDataBound not fired when the web service returns no data. Is there any function or method to resolve this issue?
KBIY
Top achievements
Rank 1
 asked on 01 Mar 2023
1 answer
48 views
Hello, I am having problems running RadClientDataSource (data is loaded into RadMultiColumnComboBox) and KendoGrid on the same page. I get strange Ajax and Kendo errors in console about stuff being undefined. Are there any known incompatibilities between some Telerik UI controls and Kendo UI widgets? Are there controls that prefer external jQuery over internal one bundled in Telerik UI?
Peter Milchev
Telerik team
 updated answer on 07 May 2021
8 answers
121 views

Hi! We have had this problem for quite some time now.We have this code:

 <telerik:RadClientDataSource ID="csDsInprog" runat="server" EnableServerPaging="false" EnableServerSorting="false" AllowPaging="false" ClientEvents-OnCustomParameter="ParameterMap" EnableViewState="false"
              ClientEvents-OnRequestEnd="showInProgressGrid">
              <DataSource>
                <WebServiceDataSourceSettings>
                  <Select Url="/user/history/Default.aspx/GetHistoryInProg" RequestType="POST" DataType="JSON" ContentType="application/json" />
                </WebServiceDataSourceSettings>
              </DataSource>
              <Schema DataName="d">
              </Schema>
            </telerik:RadClientDataSource>

 

This is the ClientDataSourceID for a radgrid. However, when there are no records returned by the URL, we see that it does multiple postbacks. If it does return information, it does the postback only once.

 

Can you help us with this one? We have updated to the latest version of the UI but still it has the same error.

Peter Milchev
Telerik team
 answered on 27 Oct 2020
1 answer
43 views

Hi i have a simple API .Net Core to get a list of College, this is my local URL ( http://localhost:58887/colleges ) and the JSON result :

[{"collegeId":1,"college":"Norco College","collegeAbbreviation":"NORCO","collegeLogo":"empty","styleSheet":"/Common/css/NORCO.css","pendingDataIntake":false,"districtId":1,"checkExistOtherColleges":true},{"collegeId":2,"college":"Riverside City College","collegeAbbreviation":"RCC","collegeLogo":"","styleSheet":"/Common/css/RCC.css","pendingDataIntake":false,"districtId":1,"checkExistOtherColleges":true},{"collegeId":3,"college":"Moreno Valley College","collegeAbbreviation":"MVC","collegeLogo":"","styleSheet":"/Common/css/MVC.css","pendingDataIntake":false,"districtId":1,"checkExistOtherColleges":true},{"collegeId":4,"college":"NORCO College - Syllabus Manager","collegeAbbreviation":"NORCO","collegeLogo":"","styleSheet":"/Common/css/NORCO.css","pendingDataIntake":false,"districtId":2,"checkExistOtherColleges":true},{"collegeId":5,"college":"Testing College","collegeAbbreviation":"TST","collegeLogo":"logo.png","styleSheet":"/Common/css/NORCO.css","pendingDataIntake":true,"districtId":2,"checkExistOtherColleges":false},{"collegeId":6,"college":"Mt San Jacinto","collegeAbbreviation":"MSJC","collegeLogo":"","styleSheet":"/Common/css/NORCO.css","pendingDataIntake":false,"districtId":2,"checkExistOtherColleges":false},{"collegeId":7,"college":"Crafton Hills College","collegeAbbreviation":"CHC","collegeLogo":" ","styleSheet":"/Common/css/NORCO.css","pendingDataIntake":false,"districtId":2,"checkExistOtherColleges":false},{"collegeId":8,"college":"San Bernardino Valley College","collegeAbbreviation":"SBC","collegeLogo":" ","styleSheet":"/Common/css/NORCO.css","pendingDataIntake":false,"districtId":2,"checkExistOtherColleges":false},{"collegeId":9,"college":"Chaffey College","collegeAbbreviation":"CHC","collegeLogo":" ","styleSheet":"/Common/css/NORCO.css","pendingDataIntake":false,"districtId":2,"checkExistOtherColleges":false},{"collegeId":10,"college":"Barstow College","collegeAbbreviation":"BC","collegeLogo":" ","styleSheet":"/Common/css/NORCO.css","pendingDataIntake":false,"districtId":2,"checkExistOtherColleges":false},{"collegeId":11,"college":"College of the Desert","collegeAbbreviation":"COD","collegeLogo":" ","styleSheet":"/Common/css/NORCO.css","pendingDataIntake":false,"districtId":2,"checkExistOtherColleges":false},{"collegeId":12,"college":"Cooper Mountain College","collegeAbbreviation":"CMC","collegeLogo":" ","styleSheet":"/Common/css/NORCO.css","pendingDataIntake":false,"districtId":2,"checkExistOtherColleges":false},{"collegeId":13,"college":"Palo Verde College","collegeAbbreviation":"PVC","collegeLogo":" ","styleSheet":"/Common/css/NORCO.css","pendingDataIntake":false,"districtId":2,"checkExistOtherColleges":false},{"collegeId":14,"college":"Victor Valley College","collegeAbbreviation":"VVC","collegeLogo":" ","styleSheet":"/Common/css/NORCO.css","pendingDataIntake":false,"districtId":2,"checkExistOtherColleges":false},{"collegeId":15,"college":"Palomar College","collegeAbbreviation":"PAL","collegeLogo":" ","styleSheet":"/Common/css/NORCO.css","pendingDataIntake":false,"districtId":2,"checkExistOtherColleges":false}]

 

Then im trying to populate a RdaGrid with a RadClientDataSource, this is my code 

 

            <telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" runat="server" ClientDataSourceID="RadClientDataSource1" AllowPaging="true" AllowSorting="true" AllowFilteringByColumn="true"><br>                <MasterTableView ClientDataKeyNames="CollegeID" EditMode="Batch" CommandItemDisplay="Top" BatchEditingSettings-HighlightDeletedRows="true"><br>                    <Columns><br>                        <telerik:GridBoundColumn DataField="collegeId" HeaderText="College ID" ReadOnly="true"><br>                        </telerik:GridBoundColumn><br>                        <telerik:GridBoundColumn DataField="college" HeaderText="College Name" ColumnEditorID="GridTextBoxEditor"><br>                        </telerik:GridBoundColumn><br>                    </Columns><br>                </MasterTableView><br>                <ClientSettings><br><br>                </ClientSettings><br>            </telerik:RadGrid><br>        </div><br>        <telerik:GridTextBoxColumnEditor ID="GridTextBoxEditor" runat="server" TextBoxStyle-Width="230px"></telerik:GridTextBoxColumnEditor><br>        <telerik:RadClientDataSource ID="RadClientDataSource11" runat="server" AllowBatchOperations="true"><br>            <DataSource><br>                <WebServiceDataSourceSettings BaseUrl="http://localhost:58887/"><br>                    <Select Url="colleges" DataType="JSON" /><br>                </WebServiceDataSourceSettings><br>            </DataSource><br>            <Schema><br>                <Model ID="CollegeId"><br>                    <telerik:ClientDataSourceModelField FieldName="collegeId" DataType="String" /><br>                    <telerik:ClientDataSourceModelField FieldName="college" DataType="String" /><br>                </Model><br>            </Schema><br>        </telerik:RadClientDataSource><br><br>        <telerik:RadClientDataSource runat="server" ID="RadClientDataSource1"><br>            <DataSource><br>                <WebServiceDataSourceSettings ServiceType="OData"><br>                    <Select Url="http://localhost:58887/colleges" DataType="JSONP" /><br>                </WebServiceDataSourceSettings><br>            </DataSource><br>        </telerik:RadClientDataSource>

 

None of them are working, the RadGrid its showing no records

Please advice
Regards,

Alberto

Attila Antal
Telerik team
 answered on 06 Oct 2020
4 answers
158 views

Could someone provide an example of how to use ClientDataSource in an ASP.NET WebForms environment?

e.g. with PageMethods which pass data back to the client for usage in, say, a combobox?

 

All the examples I see online deal with MVC or Web Service configurations and do not provide adequate documentation on how to use in a legacy webforms environment.

 

 

ToltingColtAcres
Top achievements
Rank 2
Veteran
Iron
 answered on 24 Jun 2020
1 answer
42 views

I'm using the following ClientDataSource to bind a radgrid. 

<telerik:RadClientDataSource runat="server" ID="clientDataSourceGrid">
    <ClientEvents OnCommand="dataSourceCommand" OnRequestStart="requestStart"  OnRequestEnd="requestEnd"  />
    <DataSource>
        <WebServiceDataSourceSettings>
            <Select Url="../../api/apd" RequestType="Get" />
            <Insert Url="../../api/apd" RequestType="Post" />
            <Update Url="../../api/apd" RequestType="Put" />
            <Delete Url="../../api/apd" RequestType="Delete" />
        </WebServiceDataSourceSettings>
    </DataSource>
    <Schema>
        <Model ID="APDId">
            <telerik:ClientDataSourceModelField FieldName="AM" DataType="String" />

 

The Web API action to do the update is as follows:

 

public void PutAPD(int id, APD apd)
  {
 
        // Do the update ....
 
        // How can I return a message in case something goes wrong in the update?
 
  }

My question is: how can I return a message from PutAPD back to the client? I want to be able to inform the user in case the update failed.

My 

 

                    


Eyup
Telerik team
 answered on 28 May 2020
1 answer
54 views

As per the documentation on .fetch():

"The fetch method makes a request to the remote service only the first time it is called"

Why???

 

If a RadGrid is client bound to RadClientDataSource,  I can call .rebind() on the grid and it will call the Select webservice again,   so there must be a way to "reset" something so that .fetch() will call the webservice every time it's called?

CDK
Top achievements
Rank 1
 answered on 10 Jan 2020
9 answers
287 views

I’m trying to set up a call to an api method inside of some client side javascript.
The javascript function (GetDb) is called from the ClientEvents-OnValueChanged event of a RadMaskedTextBox

In that javascript function I set the url of a RadClientDataSource and do a fetch. To be honest I don’t completely understand how this works and how I can access the data using the RadClientDataSource after the fetch. My goal is to call the api through the javascript and get data back that I need to use.

As you can see in the RadClientDataSource, I have a dummy url which I replace in the Javascript function GetDb. I did this because if there was an empty url in the RadClientDataSource I was unable to set the dataSource._transport.read.url in the javascript. The url will have to be created dynamically in the long run (right now it’s hard coded) so I am changing the transport url in the javascript. Eventually the final parameter in the rest call in the url will have to be passed and will be variable.

From what I can see the a RadClientDataSource is not being activated and the api method is not being called. After the fetch I looked at the data source property and there were no rows

I set up the API by creating a Controllers folder in my project and then adding a scaffolded controller that uses Entity framework. This API controller inherits from APIController.

I tested the controller by running the function I want to use (GetMeasureByControlName) in fiddler and it worked.

Below is the code. I pieced this together from existing examples but there is none that do exactly what I want. I’d appreciate any help.

<telerik:RadMaskedTextBox ID="RadMaskedTextBox1" runat="server" Width="80px" Mask="##.##" ClientEvents-OnValueChanged="GetDb" >  </telerik:RadMaskedTextBox>



<telerik:RadClientDataSource runat="server" ID="RadClientDataSource1">
    <DataSource>
        <WebServiceDataSourceSettings ServiceType="OData">
            <Select Url="localhost:53558/api/measure/GetProductById/blah" DataType="JSONP" />
        </WebServiceDataSourceSettings>
    </DataSource>
</telerik:RadClientDataSource>

I set a dummy url because unless there was something in there I couldn’t reset the transport url below in GetDb (javascript function).

 

Here is Clientside code called by the RadMaskedTextBox1 above:

function GetDb(sender, args) {
            debugger;
            var docTypeID='<%=Session["DocTypeId"]%>';
            if (args != null) {
                var value = args.get_newValue();
                var dataSource = $find("<%= RadClientDataSource1.ClientID%>");
                dataSource._transport.baseUrl = 'http://localhost:53558/api/documentmeasuretypes/';
                dataSource._transport.read.url = dataSource._transport.baseUrl + "GetMeasureByControlName/CYLINDER%20BLOCK%20HEIGHT";
                dataSource.fetch();
                var items = dataSource.view();
                var item = items[0];
                alert(item);
                alert('after fetch');
            }
        }

After the fetch the Total rows in the data source was 0.

The controller method does work; I tested it in fiddler. Here it is.
        public DocumentMeasureType GetMeasureByControlName(string controlname)
        {
            using (APIManufacturingEntitiesConsolidated db = new APIManufacturingEntitiesConsolidated())
            {
                var product = db.DocumentMeasureTypes.FirstOrDefault(m => m.MeasureName.Contains(controlname));
                if (product == null)
                {
                    throw new HttpResponseException(HttpStatusCode.NotFound);
                }
                return product;
            }
        }

 

And here is the routing:
  RouteTable.Routes.MapHttpRoute(
           name: "ActionApi",
           routeTemplate: "api/{controller}/{action}/{controlname}",
           defaults: new { id = RouteParameter.Optional }
);

            RouteTable.Routes.MapHttpRoute(
            name: "DefaultApi",
            routeTemplate: "api/{controller}/{id}",
            defaults: new { id = System.Web.Http.RouteParameter.Optional }




Eric R | Senior Technical Support Engineer
Telerik team
 answered on 27 Dec 2019
2 answers
85 views

I'm hoping this is a silly error

this is the markup

<telerik:RadClientDataSource ID="ClaimsDataSource" runat="server" EnableServerPaging="true" EnableServerSorting="true" AllowPaging="true"  >
    <DataSource>                              
        <WebServiceDataSourceSettings BaseUrl="http://localhost:39338/" >
            <Select Url="ui/list/claims" RequestType="Get" DataType="JSON" EnableCaching="true"  />
        </WebServiceDataSourceSettings>
    </DataSource>           
    <Schema DataName="Data">
        <Model>
            <telerik:ClientDataSourceModelField FieldName="DateofLoss" DataType="Date" />
        </Model>
    </Schema>
</telerik:RadClientDataSource>
 
<telerik:RadGrid ID="grdCLaims" runat="server" ClientDataSourceID="ClaimsDataSource" AllowPaging="true" PageSize="2" AllowSorting="true"  >
    <MasterTableView ClientDataKeyNames="ClaimItemID" DataKeyNames="ClaimItemID">
        <Columns>                       
            <telerik:GridBoundColumn DataField="PolicyNumber" HeaderText="Policy Number" />
            <telerik:GridBoundColumn DataField="ClientName" HeaderText="Client" />
            <telerik:GridBoundColumn DataField="DateofLoss" HeaderText="Date of Loss" DataFormatString="{0:dd MMM yyyy}" />
        </Columns>
    </MasterTableView>
    <ClientSettings>
        <Selecting AllowRowSelect="true" />           
        <Scrolling AllowScroll="true" UseStaticHeaders="true" />
    </ClientSettings>
</telerik:RadGrid>

 

this is the JSON that the service is returning

{
   "Data":[
      {
         "ClientName":"Ethan McWindsor",
         "PolicyNumber":"PUMA100558",
         "DateofLoss":"2015-12-09T00:00:00",
         "ClaimItemID":256,
      },
      {
         "ClientName":"Ethan McWindsor",
         "PolicyNumber":"PUMA100558",
         "DateofLoss":"2016-11-25T00:00:00",
         "ClaimItemID":413,
      }
   ],
   "Count":2
}

no matter what i do, the service is getting called three times on the in initial page load

from the network log in chrome

http://localhost:39338/ui/list/claims?take=2&skip=0&page=1&pageSize=2
 
http://localhost:39338/ui/list/claims?take=2&skip=0&page=1&pageSize=2
 
http://localhost:39338/ui/list/claims?take=10&skip=0&page=1&pageSize=10

 

(there is nothing in the code-behind)

any ideas?

Attila Antal
Telerik team
 answered on 13 Nov 2018
1 answer
69 views
I would like to use client side binding to a RESTful api that requires a token in the headers for authorization.  Is this  possible?
Peter Milchev
Telerik team
 answered on 30 May 2018
Narrow your results
Selected tags
Tags
+? more
Top users last month
horváth
Top achievements
Rank 2
Iron
Iron
Steve
Top achievements
Rank 2
Iron
Erkki
Top achievements
Rank 1
Iron
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
Jakub
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
horváth
Top achievements
Rank 2
Iron
Iron
Steve
Top achievements
Rank 2
Iron
Erkki
Top achievements
Rank 1
Iron
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
Jakub
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?