Telerik Forums
UI for ASP.NET MVC Forum
1 answer
95 views
Hello!
I have the problem:
If I use 100% scale , then I see first picture
If I use 110% or 125% scale, then  I see second picture
Why display with 125% scale is so incorrect?
scale
scale
Dimo
Telerik team
 answered on 29 Apr 2013
1 answer
113 views
Is there any way to use the virtual scrolling with a pager control?  Everything works fine except if you go to a new page and then try to scroll, it resets to the previous page.
Atanas Korchev
Telerik team
 answered on 29 Apr 2013
1 answer
181 views
Hi,

I am currently making my first
experiences with Kendo UI and a ASP.NET MVC 4 project. At the moment I have a
list stored in a standard .Net System.Collections.Sortedlist object and would
like to fill a Kendo UI combobox with the values from that list. I also tried
to first build a Kendo datasource object, that contains the elements from that
Sortedlist, but I could not get that to work.

How can I:

  • fill a Kendo UI combobox with elements from a .Net System.Collections.Sortedlist
object?

or

  • fill a Kendo UI datasource (which I will later use to create the combobox)
with elements from a .Net System.Collections.Sortedlist object?

Regards

Sven
Daniel
Telerik team
 answered on 29 Apr 2013
4 answers
961 views
Hello again,
if i want to pass inside a javascript function,a string parameter how can i do that?

for example this sentence
.ToolBar(toolBar => toolBar.Template("<a class='k-button k-button-icontext k-grid-add' onclick='addCustomCheckBoxField('IsHour')' href='javascript: void(0)'><span class='k-icon k-add'></span>add</a>"))

gives me an syntax error.
i would like to pass the IsHour as a string value for the function.
Maybe it is more a javascript problem,but it is used in kendo ui context.

Regards,
Daniel
Daniel
Top achievements
Rank 1
 answered on 29 Apr 2013
1 answer
395 views
I am using the kendo mvc grid .I want implement the scroll bar  but data part is scrolling properly but hearer of grid is not scrolling with data.

@(Html.Kendo().Grid(Model) 
    .Name("gridSyndromic")
    .Columns(columns =>
    {
        columns.Bound(p => p.Syndromes.Name).Title("Syndromes").Width(210);
        columns.Bound(p => p.Symptoms3).Title("No of Clients With").Width(210)
              
        
        columns.Command(command => { command.Edit(); command.Destroy(); }).Width(172);
    })
                           .ToolBar(toolbar =>
                           {
                               toolbar.Create();

                           })
    .Editable(editable => editable.Mode(GridEditMode.InLine))
    .Pageable()
    .Sortable()
    .Scrollable()
    .Resizable(p=>p.Columns(true))
    .HtmlAttributes(new { style = "height:506px;width:400px;" })
    .DataSource(d => d.Server().PageSize(10).Create(update => update.Action("EditingInline_Create", "Syndromic"))
                        .Read(read => read.Action("Index", "Syndromic"))
                        .Update(update => update.Action("EditingInline_Update", "Syndromic")).Destroy(update => update.Action("EditingInline_Destroy", "Syndromic"))
                        .Model(model => model.Id(p => p.SymptomsId)))
     


Thanks
Dimo
Telerik team
 answered on 29 Apr 2013
4 answers
320 views
My upload works but fires the error event and not success.
the controller returns a empty contentresult, I get no server or js errors. Upload fires error event and shows retry, yet image is uploaded and saved to database

any help. thanks

Function ImageUpload(uploadedImages As BO.Models.UploadedImage) As ContentResult
    If uploadedImages.Image.Last.ContentType.StartsWith("image/", StringComparison.OrdinalIgnoreCase) Then
        Dim imageBytes As Byte() = BO.Factory.Image.ResizeImage(194, 194, uploadedImages.Image.Last.InputStream, Drawing.Brushes.White, Drawing.Imaging.ImageFormat.Png)
        Dim thumbBytes As Byte() = BO.Factory.Image.ResizeImage(100, 100, uploadedImages.Image.Last.InputStream, Drawing.Brushes.White, Drawing.Imaging.ImageFormat.Png)
        BO.Factory.ContractorFactory.SaveImages(imageBytes, thumbBytes, uploadedImages.ContractorId)
    End If
    Return Content(String.Empty)
End Function
 
Function ImageRemove(uploadedImages As BO.Models.UploadedImage) As ContentResult
    Return Content(String.Empty)
End Function


    <img alt="@Model.Name" data-upload-image="true" src="@Url.Action("image", New With {.controller = "contractor", .area = "contractor", .id = Model.ContractorId})" />
    @code
        Dim imageUploada As Kendo.Mvc.UI.Upload = Html.Kendo.Upload().Name("Image") _
                                                  .Multiple(False) _
                                                  .Async(Function(y) y.AutoUpload(True) _
                                                             .Save("imageupload", "contractor", New With {.area = "contractor", .contractorid = Model.ContractorId}) _
                                                             .Remove("imageremove", "contractor", New With {.area = "contractor", .contractorid = Model.ContractorId})) _
                                                         .Events(Function(events) events.Success("imageUploaded").Error("onUploadError"))
        imageUploada.Render()
    End Code
</div>
<script>
    function onUploadError(e) {
        alert(e.operation)
        alert(e)
        alert(getFileInfo(e))
    }
 
    function imageUploaded(e) {
        $("img[data-upload-image]").each(function (index) {
            var url = $(this).attr("src") + '?' + Math.random() * 1000000;
            $(this).attr("src", url);
        });
    }
 
    function getFileInfo(e) {
        return $.map(e.files, function (file) {
            var info = file.name;
 
            // File size is not available in all browsers
            if (file.size > 0) {
                info += " (" + Math.ceil(file.size / 1024) + " KB)";
            }
            return info;
        }).join(", ");
    }
 
</script>
Nicholas
Top achievements
Rank 2
 answered on 28 Apr 2013
0 answers
206 views
Hi everyone,

I have some problems on using Kendo UI Grid. The first problem is when I click on page number at bottom tool bar of grid, the grid was loading for data base on page index; but while data is loading, I just suddenly clicked on another page number, then the grid is mess up with data from page index; data of this page index is viewed for data of other page index, and the page number buttons also changed automatically. It was just look like a real mess on the grid.

EG: If I click on page index 10, and while data is loading, I suddenly click on page index 6. Then the number 6 is change to red color, but the data is viewed for page 10.

EG: If grid is viewing data of page index 1, and I click page 10. While data is loading for page, I click on page 6. Then the data is viewed for page 10, but the page number button is changing red color at page 1 then jump at page 6 and then jump at page 10.

It just look like a graphic error on Kendo UI Grid. So I end up here to ask for a help.

My solution is disable all page index buttons while data in grid is loading. For example, if click on page 10 then other page number from 1 - 100 must be disable except page 10. But if the grid is finished loading, then all page number must be re-enable.

Is there JavaScript function to detect while Kendo Grid is loading data, and how to disable page index buttons, and how to re-enable page index buttons?

I need your help on my issue.

Tri
Tri
Top achievements
Rank 1
 asked on 28 Apr 2013
1 answer
102 views
This code library project (http://www.kendoui.com/code-library/permalink/NkytUzlZ1ESWI9C7cOx7MQ) works fine with the 2012.2.913 version of the MVC wrapper and script library, but it doesn't work with the 2013.1.319 version of the MVC wrapper and script library.

The thing that i've noticed with this version of the wrapper is the ModelState object is not being serialized properly by the .ToDataSourceResult() method and it returns a null value, in turn the .Json() method is returning an empty result set to the client.

Is this a bug with the .ToDataSourceResult() method? or is there a new way to return ModelState information that I'm not aware of?
Daniel
Telerik team
 answered on 26 Apr 2013
2 answers
188 views
Hello:

I have a Master/Child grid structure like so:

Parent Grid:
 @(Html.Kendo().Grid<ElementViewModel>()
.Name("gridEle")
.Columns(cols =>
{
    cols.Bound(e => e.EleNum)
})
.DataSource(dataSource => dataSource
    .Ajax()
    .Read(read => read.Action("GetElements", "Rating", pi))   
)
.ClientDetailTemplateId("tempSubEle")          
)

Child Grid as DetailTemplate:


<script id="tempSubEle" type="text/kendo-tmpl">
 
@(Html.Kendo().Grid<SubElementViewModel>()
.Name("gridSubEle_#=EleID#")
.Columns(cols =>
{
    cols.Bound(e => e.Rating)      
        .ClientTemplate("<input type='checkbox' value='1' " +
                        "#if(Rating==1){#checked='checked'#}# />" );
})
.DataSource(dataSource => dataSource
            .Ajax()
            .Read(read => read.Action("GetSubElementsByElementID", "Rating", new { eID = "#= EleID #" }))
)
.ToClientTemplate()
)
    </script>
The Problem:

I have a #if{# ... #}# statement in the column ClientTemplate, however the Rating value is from the Parent Grid not the current Child Grid (Parent Grid happen has a column also named 'Rating'), to prove that it is from Parent Grid,  if I change Rating to a column that only exists in the Child grid, i.e. SubEleID, it gives error at browser, saying that SubEleID is not found.

The Question:
so what is the syntax for Rating gets the Child Grid value?
just for the sake of trying, I even tried: data.Rating, or $(this).Rating, none worked.

Please advise,
Thank you

HSO
Top achievements
Rank 2
 answered on 26 Apr 2013
2 answers
259 views
Hi,
I am trying to use the Kendo UI Grid with ASP.NET MVC to replace an existing MVC WebGrid which displays a set of data with each row having a Submit button. The Submit button can be displayed as enabled or disabled and when pressed, the form is posted back to the Controller with the selected row identity stored in a a data item.

I can't see how to achieve this relatively simple requirement using the Kendo UI Grid.

The existing code for the MVC WebGrid is below and allows easy definition of the Submit button for each row by using the @item. syntax which is available for the WebGrid.

Is there an equivalent example for the Kendo UI Grid with MVC that shows how you display a submit button (enabled/disabled based on a row property),  submit the form, and then passback the selected row identity to the controller ?

Thanks,
Kevin Wood

@model Vsat_2.Models.AgentTeams
<div id="SearchTeams">
    <div>
        <div id="criteria">
        @Html.HiddenFor( model => model.CompanyId)@Html.HiddenFor( model => model.RegionId )@Html.HiddenFor( model => model.Selection )
        @Html.HiddenFor( model => model.SearchVal)@Html.HiddenFor( model => model.SearchCritId )@Html.HiddenFor( model => model.RowsPerPage )@Html.HiddenFor( model => model.CurrentPage )
        @Html.HiddenFor( model => model.TeamSearch.CompanyId)@Html.HiddenFor( model => model.TeamSearch.RegionId )
        Search @Html.DropDownListFor(model => model.TeamSearch.SearchCritId, Model.TeamSearch.SearchCrit) for @Html.EditorFor(model => model.TeamSearch.SearchVal)
        <input type="submit" value="Search" name="submitButton" id="Search" /> @Html.ValidationMessageFor(model => model.TeamSearch.SearchVal)<span id="Searchwait" style="visibility:hidden"> Please wait..</span>
        </div>    
        <div id="status">
            <span id="statusmessage" style="padding-left:0.5em;color:black">@Html.LabelFor(model => model.TeamSearch.SearchResult, Model.TeamSearch.SearchResult)</span>
        </div>
        <p></p>
        <div id="MainGrid" style="float:left;width:100%">
@{
        var grid2 = new WebGrid(canPage: true, rowsPerPage: Model.TeamSearch.rowsperpageid, canSort: true, defaultSort: "SearchCrit", ajaxUpdateContainerId: "grid3", pageFieldName: "TeamPage");
        grid2.PageIndex = Model.TeamSearch.page;
        grid2.Bind(Model.Teams, rowCount: Model.TeamSearch.TotalRows, autoSortAndPage: false);
        grid2.Pager(WebGridPagerModes.All, numericLinksCount: 10);

        @grid2.GetHtml(htmlAttributes: new { id = "grid3" },
                       columns: grid2.Columns(
                       grid2.Column("InternalName", header: "Agent Team", canSort: false), 
                       grid2.Column(format: @<input type="submit" @item.Disabled onclick="mySelection='@item.Identity'" value="Select Team" name="submitButton" id="Change" style="font-size:90%" />),
                       grid2.Column("Reason", canSort: false) 
                       @*grid2.Column("Name", header: "ID", canSort: false) *@
                       ));
        }
        </div>
    </div>
</div> 

<script>
    var mySelection;

    $(function () {
        $("#Change").live('click', function () {
            $("#Audit").html(""); //Clear Audit Screen
            $("#Search").css({ "visibility": "hidden" });
            $("#Searchwait").css({ "visibility": "visible" });
            $("#Selection").val(mySelection); //Set the Selection field
        });
    });

$(function () {
        $("#Search").live('click', function () {
            $("#Audit").html(""); //Clear Audit Screen
            $("#Search").css({ "visibility": "hidden" });
            $("#Searchwait").css({ "visibility": "visible" });
        });
});


</script>
Kevin
Top achievements
Rank 1
 answered on 26 Apr 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?