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 }
I am trying to redirect to another page on process cancellation (triggered by cancel button).
My progress event is running on separate thread, here is the code:
Public Sub ProgressArea()
Do
Dim dt As DataTable = AdminData.getLogPercent(Session("ProjectID"))
Dim count As Integer = dt.Rows(0)("PercentDone")
Dim message As String = dt.Rows(0)("RecordDesc")
context.SecondaryValue = "Total Progress: " & count.ToString() + "%"
context.SecondaryPercent = count.ToString()
context.CurrentOperationText = message
If Response.IsClientConnected = False Then
Response.Redirect("redirect.aspx")
End If
If count < 98 Then
'calls to itself to repeat
Thread.Sleep(1000)
Else
Exit Do
End If
Loop
End Sub
Code hits the redirect , but nothing happens. However if i redirect without clicking "Cancel" button it does work.
I am completely lost. Any help?
Thank you
Hi,
I want integrate in my website the chatbot functionality, I found the component with the features that I need
https://demos.telerik.com/aspnet-ajax/chat/overview/defaultcs.aspx
But for beginning you don't have some tutorial about how integrate Google DialogFlow with this component?
If is done some tutorial will be great for evaluate the component and after decide if I purchase this package (asp.net UI ajax)
Thanks

The version I use is 2015 Q2. The ComboBox will display unnecessary vertical scroll bar in the dropdown list when "CheckBoxes" is used.
How to depress the vertical scroll bar when it's not needed?
<telerik:RadComboBox ID="RadComboBox1" Runat="server" CheckBoxes="True">
<Items>
<telerik:RadComboBoxItem Text="Apple" Value="1" />
<telerik:RadComboBoxItem Text="Banana" Value="2" />
<telerik:RadComboBoxItem Text="Pear" Value="3" />
</Items>
</telerik:RadComboBox>

Using a radcombobox which allows typing. if you put the cursor in the textbox the Home?end keys do not work. In previous versions the Home/End key moves the cursor to the begin/end of the typed text. You can see this isn't working on your demo site https://demos.telerik.com/aspnet-ajax/combobox/examples/overview/defaultcs.aspx
This was working in version 2018.2.710.45 but broken in version 2019.3.917.45

Hello,
Currently we are using the below Telerik editor and we have a Div tag inside an anchor tag and noticed the when we switch from html to design it completely changes the html structure. Does Telerik have a fix for this issue since this is a valid html
https://demos.telerik.com/aspnet-ajax/editor/examples/overview/defaultcs.aspx
Expected HTML
<div class="image-container"><a href="~/media/9e240848ab264358a85b71a5ef739fbb.ashx?w=900" data-lightbox="9E240848-AB26-4358-A85B-71A5EF739FBB" name="AD7175-2-PR_9E240848-AB26-4358-A85B-71A5EF739FBB"></a><div class="icon-zoom"><a href="~/media/9e240848ab264358a85b71a5ef739fbb.ashx?w=900" data-lightbox="9E240848-AB26-4358-A85B-71A5EF739FBB" name="AD7175-2-PR_9E240848-AB26-4358-A85B-71A5EF739FBB"> test</a></div></div>
Telerik is change it to , as you notice it adds additional anchor tags
<div class="image-container"><a href="~/media/9e240848ab264358a85b71a5ef739fbb.ashx?w=900" data-lightbox="9E240848-AB26-4358-A85B-71A5EF739FBB" name="AD7175-2-PR_9E240848-AB26-4358-A85B-71A5EF739FBB">
</a>
<div class="icon-zoom"><a href="~/media/9e240848ab264358a85b71a5ef739fbb.ashx?w=900" data-lightbox="9E240848-AB26-4358-A85B-71A5EF739FBB" name="AD7175-2-PR_9E240848-AB26-4358-A85B-71A5EF739FBB"> test</a></div>
</div>
Please advise how this can be fixed.

