Telerik Forums
UI for ASP.NET MVC Forum
5 answers
874 views

I have a PartialView which is updated using AJAX. The HTML elements are loaded correctly when updating the Div using AJAX, but the Telerik chart is not loaded. The datasource in the chart is not calling the Action method:

.DataSource(ds => ds.Read(read => read.Action("Movies_Read", "Movies")))

When the PartialView is initially loaded, not using AJAX, the datasource is calling the action method and the chart is loaded correctly.
According to Telerik ASP.NET PartialView AJAX there needs to be this Javascript call for the OnSuccess event:

<script type="text/javascript"> function updatePlaceholder(context) { // the HTML output of the partial view var html = context.get_data(); // the DOM element representing the placeholder var placeholder = context.get_updateTarget(); // use jQuery to update the placeholder. It will execute any JavaScript statements $(placeholder).html(html); // return false to prevent the automatic update of the placeholder return false; }

I have tried the javascript mentioned in the documentation, but the get_data() and get_updateTarget() does not exists event though I havde added the MicrosoftAjax.js and MicrosoftMvcAjax.js. I suspect that these are deprecated. I have also tried other javascript functions but without any luck.
My AJAX call is:

@using (Ajax.BeginForm("UpdateMoviesChart", "Movies", new AjaxOptions { UpdateTargetId = "MoviesDiv", InsertionMode = InsertionMode.Replace, OnSuccess = "updatePlaceholder", }))

How do I load the Telerik Chart correctly when using AJAX?

Vladimir Iliev
Telerik team
 answered on 12 Jan 2016
7 answers
1.6K+ views

Hi,

according to what is written in this answer, binding a grid on initial page (or view) load using BindTo will prevent the Ajax request (if there is any data).
IMHO, even if the there is no data, if I explicitly bind the grid, it should not make any other attempt to get the data.

Anyway, how can I prevent the request even if there is no initial data?

Thank you.

 

Kiril Nikolov
Telerik team
 answered on 12 Jan 2016
5 answers
943 views

We are displaying kendo grid in bootstrap modal popup. The grid is editable and user can add/delete the data.Now, we have a need where the user needs to be able to upload the excel document and display excel data in the kendo grid.

Are there any code samples which shows how we can import excel document in Kendo grid?

 

Thanks.

 

Plamen
Telerik team
 answered on 12 Jan 2016
3 answers
224 views
We are facing an issue with Kendo numeric textbox.

In numeric textbox, when user tries to enter the value as “9 999 999 999 999 999, 99”, it automatically converts to “10 000 000 000 000 000, 00”.
The converted value is passed to model also.
We have an requirement to restrict user to allow enter values up to “9 999 999 999 999 999, 99”.

Kindly check and provide your feedback.
Konstantin Dikov
Telerik team
 answered on 11 Jan 2016
2 answers
552 views

I have a View with a Kendo TabStrip containing multiple grids on multiple panels. On one grid, I need to select the first row after loading data. I'm trying to do this with:

function publicUsersGridDataBound() {
  // Select the first row.
  var grid = $('#publicUsersGrid').data('kendoGrid');
 
  grid.select("tr:eq(1)");
};

 

This works when publicUsersGrid is the only grid on the View.

When I add more grids,

grid.select("tr:eq(1)");

results in the first row in the first grid getting selected, not the first row in publicUsersGridDataBound, even though when I debug the javascript function, the line

var grid = $('#publicUsersGrid').data('kendoGrid');

gets a reference to the correct grid.

I'm stumped.

TIA

Greg
Top achievements
Rank 1
 answered on 08 Jan 2016
7 answers
300 views

This grid is working. It has a DropDownList in the muni_code column's EditorTemplate, which also works.

@(Html.Kendo().Grid<PublicUserMunicipality>()
                  .Name("publicUserMunicipalitiesGrid")
                  .Columns(columns =>
                    {
                      columns.Bound(u => u.muni_code).EditorTemplateName("muni_codesList");
                      columns.Bound(u => u.SuperUser).ClientTemplate("<input type='checkbox' #= SuperUser ? checked='checked' : '' # ></input>");
                      columns.Bound(u => u.CanSubmitForms).ClientTemplate("<input type='checkbox' #= CanSubmitForms ? checked='checked' : '' # ></input>");
                      columns.Command(command => { command.Edit(); command.Destroy(); }).Width(180);
                    })
                  .ToolBar(toolbar => toolbar.Create())
                  .DataSource(dataSource => dataSource
                    .Ajax()
                    .Model(model => model.Id(p => p.Id))
                    .Read(read => read.Action("PublicUserMunicipalitiesRead", "PublicUserMunicipalities")
                                            .Data("getSelectedPublicUserId"))
                    .Create(create => create.Action("PublicUserMunicipalitiesCreate", "PublicUserMunicipalities"))
                    .Update(update => update.Action("PublicUserMunicipalitiesUpdate", "PublicUserMunicipalities"))
                    .Destroy(destroy => destroy.Action("PublicUserMunicipalitiesDestroy", "PublicUserMunicipalities"))
                  )
                )

 

I want to use the same DropDownList in non-edit mode. i.e. Have the ClientTemplate the same as the EditorTemplate.

I don't see the utility of posting the various failed attempts I've made to the

columns.Bound(u => u.muni_code).EditorTemplateName("muni_codesList");

line so I'll stop here.

Thanks.

Greg
Top achievements
Rank 1
 answered on 08 Jan 2016
1 answer
91 views
Can boostrap.js and bootstrap.css be included on the page with kendo boostrap files? What order do they need to be included in?
Sebastian
Telerik team
 answered on 08 Jan 2016
1 answer
1.0K+ views

I have a popup editor template where I wish to have 2 update buttons instead of the standerd 1.

 

The first one is supposed to function as normally.

 

The second one is supposed to change a hidden value in the editor template and then trigger the grid update.

 

How would I go about:

1: adding the extra button next to the Update Button.

2: Updating the value in the "HiddenFor" object and then triggering the grid's Update Function? 

Boyan Dimitrov
Telerik team
 answered on 08 Jan 2016
1 answer
110 views

In my BundleConfig.cs file I have the following...

            bundles.Add(
                new ScriptBundle("~/Scripts/JQueryUI").Include(
                    "~/Scripts/jqueryUI/jquery.js",            // Jquery UI
                    "~/Scripts/jqueryUI/jquery-ui.min.js"   // Jquery UI
                )
            );

            bundles.Add(new StyleBundle("~/Content/JQueryCSS").Include(
                "~/Content/jquery-ui.min.css" // Jquery UI CSS file
                )
            );

These files are to allow me to easily create a slide-out panel using the JQueryUI library which sits on top of the standard JQuery library.

Rendering the scripts in the Layout.cshtml file like this...

    @Scripts.Render("~/bundles/modernizr")
    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/jqueryval")
    @Scripts.Render("~/bundles/kendo")
    @Styles.Render("~/Content/css")
    @Styles.Render("~/Content/kendo/css")
    @Scripts.Render("~/Scripts/leylascriptlibrary")
    @Styles.Render("~/Content/JQueryCSS")
    @Scripts.Render("~/Scripts/JQueryUI")

... results in the following error when the Grid is populated...

    "TypeError: Object doesn't support property or method 'kendoGrid'\n   at Anonymous function (Unknown script code:2:20)\n   at fire (http://localhost/LeylaPublicWeb/Scripts/jqueryUI/jquery.js:3048:5)\n   at add (http://localhost/LeylaPublicWeb/Scripts/jqueryUI/jquery.js:3094:7)\n   at ready (http://localhost/LeylaPublicWeb/Scripts/jqueryUI/jquery.js:271:3)\n   at init (http://localhost/LeylaPublicWeb/Scripts/jqueryUI/jquery.js:214:4)\n   at jQuery (http://localhost/LeylaPublicWeb/Scripts/jqueryUI/jquery.js:63:3)\n   at Global code (Unknown script code:2:2)\n   at globalEval (http://localhost/LeylaPublicWeb/Scripts/jqueryUI/jquery.js:611:6)\n   at domManip (http://localhost/LeylaPublicWeb/Scripts/jqueryUI/jquery.js:6281:9)\n   at append (http://localhost/LeylaPublicWeb/Scripts/jqueryUI/jquery.js:6047:3)"

The grid never completes loading and the site just hangs.

There is something that clashes between the Kendo library and the JQueryUI library.  Rearranging the order in which the scripts are rendered places the error elsewhere, but it still gives me an error.

Has anyone seen this before?

I am using the JQuery-ui library 1.11 downloaded from here: http://jqueryui.com/

Vladimir Iliev
Telerik team
 answered on 08 Jan 2016
1 answer
210 views

how can get the spreadsheet from workbook if the workbook is created from to json?

 

public ActionResult MyAction(string data, string extension)
        {
          
            Workbook workbook = Workbook.FromJson(data);

            // I need do something here with the spreadsheet
        }
    }

T. Tsonev
Telerik team
 answered on 08 Jan 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?