Telerik Forums
UI for ASP.NET MVC Forum
3 answers
729 views

I have a simple multiselect like so:

@(Html.Kendo().MultiSelectFor(x => x.CourseId)
      .DataValueField("Id")
      .DataTextField("Name")
       .Placeholder("Select Course...")
      .ClearButton(false)
      .DataSource(source =>
      {
          source.Read(read =>
          {
              read.Action("GetCourseCodeList", "Home");
          })
          .ServerFiltering(true);
      })
      .MaxSelectedItems(1)
      .HtmlAttributes(new { @class = "" }))

When I enter text, the search is submitted once with the text entered, then a second time with the Placeholder text, or if no Placeholder, with empty string.

public JsonResult GetCourseCodeList(string text, int categoryId=0)
{
    var items = _courseData.Where(x =>
        x.Name.Contains(text) &&
        (categoryId == 0 || x.CategoryId == categoryId)).OrderBy(x => x.Name).ToList();
 
    var userinput = text;
 
    var result = new JsonResult
    {
        JsonRequestBehavior = JsonRequestBehavior.AllowGet,
        Data = items
    };
    return result;
}

A sample project replicating the issue is here : https://github.com/SteveWortho/TLCKendoTest 

It must be something simple I am doing wrong - any advice appreciated.

Using;

VS2017 Pro Version 15.5.1

KendoUI MVC 2017.3.1026

Chrome Version 63.0.3239.132 or Microsoft Edge or FireFox. Issue is repeatable.

So I must be firing the onChange event a second time with some of this configuration maybe?

But it is such a simple example.

Thanks in advance,

Steve

 

 

 

Rick
Top achievements
Rank 1
Iron
 answered on 10 Jun 2025
1 answer
68 views

Hi,

I have a Kendo Grid and its first column is a Datetime and Its a Kendo DatePicker.

When the user click on Add new record button then the 1st cell which is a date picker should be auto focus.

Note: When the user click on Add new record button then we are sorting the grid in ascending order so that the new row should appear on the top, which is working fine but the 1st cell of the newly created row a Kendo Date picker in not in focus.

 

But when the user click on the first cell of the newly created row, then it opens the datepicker to allow user to select a date.

 

My requirement is when i am clicking the Add new record button then 
1. It should sort in ascending order (Which is working now)

2. The 1st cell of the Kendo Datepicker should auto focus like the above screenshot.


 
abdul
Top achievements
Rank 2
Iron
Iron
 updated question on 09 Jun 2025
1 answer
119 views

Hi,

I have a requirement in the Kendo grid

1. When the user click on cross icon in each row in the action column then the row should be deleted.

2. In the last available row, a + icon should display and when the user clicks the + icon then it should create new row in the grid 

instead of normal Add new record button.

 

 

 

 

 

abdul
Top achievements
Rank 2
Iron
Iron
 updated question on 09 Jun 2025
1 answer
68 views

Hi,

I want to load a kendo grid, after load the grid should add a new row at the bottom of the grid.

 

When the Kendo grid loads then, it is creating the new row, but after that it will load the records from the database and then refresh the screen and the new row is removing.

abdul
Top achievements
Rank 2
Iron
Iron
 updated question on 09 Jun 2025
1 answer
37 views

Hi,

I have a kendo grid, where i am creating a new empty row while loading the grid.

The grid has a Boolean filed which is a mandatory field. so when we want to enter the row values then it should call the CheckIsPublicFund(data) method and if the user is not selecting the Boolean field then it should add that value to false.

The problem is when selecting the Boolean value then its not firing the CheckIsPublicFund(data)  method.

 


 


abdul
Top achievements
Rank 2
Iron
Iron
 updated question on 09 Jun 2025
1 answer
44 views

Hi,

I am working on a kendo grid, where user can copy records from the excel and paste in the kendo grid.

But when we copy more than 50 records from the excel and paste in the kendo grid then it is taking some time.

Can we increase the performance while pasting in to the Kendo grid or is it possible we can provide a progress bar or something to show to the user when the user paste more than 50 record.

 

abdul
Top achievements
Rank 2
Iron
Iron
 updated question on 09 Jun 2025
2 answers
34 views
Hi,

I'm using Kendo UI for ASP.NET MVC and I need to add an HTML link (<a href="...">) inside the CategoryAxis.Labels.Template or the ValueAxis.Labels.Template of a Bar Chart. Here is a simplified version of my code:

@(Html.Kendo().Chart()
    .Name("productsChart")
    .Series(series =>
    {
        series.Bar(new[] { 100, 200, 300 }).Name("Sales");
    })
    .CategoryAxis(axis => axis
        .Categories("Product A", "Product B", "Product C")
        .Labels(labels => labels
            .Template("<a href='https://example.com/product/#= value #' target='_blank'>#= value #</a>")
        )
    )
)


However, the chart only displays the raw text of the <a> tag instead of rendering it as a clickable HTML link. I understand this may be due to the chart rendering via SVG and not supporting HTML natively in axis labels.

Is there any workaround or supported way to:

Render actual HTML in axis labels?

Enable links or interactive elements within axis labels?

I’ve already considered using tooltips and seriesClick events as alternatives, but my goal is to have direct clickable links inside the axis labels themselves.

Thanks for your help!
Eyup
Telerik team
 answered on 03 Jun 2025
1 answer
50 views

Hello,

I created new project using Telerik wizard. I am trying to populate a grid with data-source using ajax but I am failing at using ToDataSourceResult. I am getting error 

'IEnumerable<Person>' does not contain a definition for 'ToDataSourceResult' and the best extension method overload 'QueryableExtensions.ToDataSourceResult(DataTable, DataSourceRequest)' requires a receiver of type 'System.Data.DataTable'

I compared it with project created by Telerik wizard for page with grid and still don't see why this error occurs.

Please see attached figure. It is screenshot taken from HomeController where I am trying to get data-source from IEnumerable. 

Radek
Top achievements
Rank 2
Iron
 answered on 03 Jun 2025
1 answer
35 views

Hi,

I'm trying to figure out how to transpose columns in a Kendo Grid using the Html helper. 

I see that there's this small piece of documentation for jQuery (https://docs.telerik.com/kendo-ui/knowledge-base/transposed-grid), but would ideally like to do it on the helper itself.

Is anyone aware of how to do this? 

Any help is much appreciated!

Mihaela
Telerik team
 answered on 23 May 2025
1 answer
27 views

Hi,

I have a problem displaying the content from the AIPrompt Output tab and I'm getting An error occurred while processing the request.

I'm not sure if I'm missing a parameter returning  the response from the content. I am using OpenAI as a service.

  • Here is my code

public async Task<ActionResult> GenerateSupplierAIReponse()
{
    var apiKey = ConfigurationManager.AppSettings["OpenAPIKey"];
    var aiServiceUrl = "https://api.openai.com/v1/chat/completions";
    StringBuilder sb = new StringBuilder();
    using (var httpClient = new HttpClient())
    {
        httpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", apiKey);

        try
        {
            using (var requestStream = new StreamReader(HttpContext.Request.InputStream))
            {
                var body = await requestStream.ReadToEndAsync();
                var requestBody = new
                {
                    model = "gpt-4",
                    messages = new[]
                    {
                        new { role = "user", content = body }
                    }
                };

                var response = await httpClient.PostAsJsonAsync(aiServiceUrl, requestBody);
             
                response.EnsureSuccessStatusCode();
                var jsonResponse = await response.Content.ReadAsStringAsync();
                OpenAIResponse aIResponse = JsonConvert.DeserializeObject<OpenAIResponse>(jsonResponse);


                foreach (var i in aIResponse.choices)
                {
                    sb.AppendLine(i.message.content);
                }

                var formattedResponse = new
                {
                    Output = sb.ToString(),
                };

                string finalJsonResult = new JavaScriptSerializer().Serialize(formattedResponse);
                return Content(finalJsonResult, "application/json");
            }

        }
        catch (HttpRequestException ex)
        {
            // Log the error
            Console.Error.WriteLine($"HTTP Error: {ex.Message}");
            return Json(new { error = "Error communicating with OpenAI." }, JsonRequestBehavior.AllowGet);
        }
        catch (Exception ex)
        {
            // Log the error
            Console.Error.WriteLine($"General Error: {ex.Message}");
            return Json(new { error = "An unexpected error occurred." }, JsonRequestBehavior.AllowGet);
        }
    }

}

 

  • Here is the example content that I'm about to return.

"{\"Output\":\"As an AI, I don\\u0027t have real-time data access, but as of my last update, I don\\u0027t have specific information about the parent company of Acme Electronics. Acme is a common generic name used in various forms of fiction, and there could be many small companies by that name. It would help if you were more specific about the company\\u0027s location or other details.\\r\\n\"}"

 

  • and here is my UI
@(Html.Kendo().AIPrompt()
    .Name("aiprompt")
    .ActiveView(0)
    .Service("GenerateSupplierAIReponse", "Supplier")
    //.Events(events => events
    //    .PromptRequest("onPromptRequest")
    //)
    .ToolbarItems(items =>
    {
        items.Add().Type(ItemType.Spacer);

        items.Add()
             .Type(ItemType.Button)
             .Icon("x")
             .FillMode(ButtonFillMode.Flat)
             .Rounded(Rounded.Full)
             .ThemeColor(ThemeColor.Primary)
             .Click("onToolbarButtonClick");
    })
    .Views(views =>
    {
        views.Add().Type(Kendo.Mvc.UI.ViewType.Prompt)
        .PromptSuggestions(new string[] { "What is the parent company of " + Model.Name, "Give me the headquarter address of " + Model.Name });
        views.Add().Type(Kendo.Mvc.UI.ViewType.Output);
    })
)

 

  • and here is the result

Everything is getting all the correct authentication and the ai response message content but upon returning the content it will prompt an error message. 

Please advice.

Thank you,

Gerber Manalo


 

Gerber
Top achievements
Rank 1
Iron
 answered on 22 May 2025
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?