Telerik Forums
UI for ASP.NET MVC Forum
1 answer
108 views
I'm trying to enable the ShowLineImages property for ASP.NET MVC TreeView.

How can I do this?
Iliana Dyankova
Telerik team
 answered on 11 Feb 2015
1 answer
193 views
I am implementing Kendo Editor with image and file browser capabilities.

I have followed the example in demos, and have run into a problem.

Image browser works fine when I use gif or jpeg files, but if I try to use a bmp file, I get a 403 error.

For file browser, I am unable to get a simple xls file to upload without a 403 error.

I know the code is working, as I can upload gif and xls files.  Is there another configuration change or other piece of code that is not included in the Demo that needs to be added for me to change the file types accepted by the browser?

I tried the following:
                   .FileTypes(".bmp,.jpg,.jpeg,.gif,.png")

While that does restrict what the user can attempt, it doesn't allow me to use the file types I need.
Abradax
Top achievements
Rank 1
 answered on 09 Feb 2015
2 answers
289 views
The objects that are enumerated in my Kendo MVC Grid are of type dynamic:

@(Html.Kendo().Grid<dynamic>()
...

I am using InLine editing.  I am able to specify the editor for each of my fields as described here:

http://www.telerik.com/forums/inline-editing-mode-and-dynamic-object
http://docs.telerik.com/kendo-ui/aspnet-mvc/helpers/grid/editor-templates

I won't reiterate the approach that is described above, but in summary it involves adding a UIHint attribute to fields in the model, and then using EditorTemplateName to identify an editor template for the field (and that editor template refers to the field via the Name() method).  This works.

The problem that I have is that many of my fields need to appear in non-editable columns.  My hope was that I could get the grid to render those fields as is (no editor) by:

a. Omit the UIHint attribute from model properties that would not be editable
b. Not specify an EditorTemplateName for non-editable bound columns
c. Set Editable(false) when defining the model (as below):

.DataSource(d =>
{
     d.Ajax()
        .Model(m =>
         {
             m.Id("Id");
             m.Field("Name", typeof(string)).Editable(false);

However, when I do this the grid fails to load and I see an exception in Fiddler:

[RuntimeBinderException: 'object' does not contain a definition for 'Name']
   CallSite.Target(Closure , CallSite , Object ) +152
   System.Dynamic.UpdateDelegates.UpdateAndExecute1(CallSite site, T0 arg0) +662
   lambda_method(Closure , Object ) +133
   Kendo.Mvc.UI.Html.GridDataCellBuilder`2.AppendCellContent(IHtmlNode td, Object dataItem) +131
   Kendo.Mvc.UI.Html.GridDataCellBuilderBase.CreateCell(Object dataItem) +230

I have many fields and most of them wil be non-editable, so I would rather not, for example, create editor templates for each of them that contain disabled controls.

What is the best way to configure all my non-editable columns in an InLine grid that is bound to dynamic objects?

thanks,
Derek
Derek
Top achievements
Rank 1
 answered on 06 Feb 2015
1 answer
289 views
Hi,

I'm binding my grid to a DataTable for displaying dynamic search results. I've followed the example on how to do binding with DataTable, but I was wondering if there is a way to reference a different column in the Template / ClientTemplate. I've tried what I regularly do when bound to a Model/ViewModel, but it doesn't seem to work for DataTables. I've tried both

This is what my grid looks like:

@(Html.Kendo().Grid(Model.Result.Data)
    .Name("gridSearchResults")
    .Columns(columns =>
    {
        foreach (System.Data.DataColumn column in Model.Result.Data.Columns)
        {
            if (column.ColumnName != "Id")
            {
                if (column.ColumnName == "Name")
                {
                    columns.Bound("Name").Template(@<text><a href='" + Url.Action("Details", Model.Result.DataSource) + "/#= Id #'" + ">#= Name #</a></text>);
                }
                else
                {
                    columns.Bound(column.ColumnName);
                }
            }
        }
    })
    .DataSource(d => d
        .Server()
        .Model(m => {
            m.Id("Id");
            foreach (System.Data.DataColumn column in Model.Result.Data.Columns)
            {
                m.Field(column.ColumnName, column.DataType);
            }
        })
    )
)

Model.Result.Data is of type DataTable. It renders all the columns fine, but I'd like the name column to be a hyperlink to the details page.. Any suggestions?

Thank you 
Katia
Top achievements
Rank 1
 answered on 06 Feb 2015
4 answers
196 views
All, 

Please see the following video: http://www.screencast.com/t/9UbonHDdPK0 . 

In this video it shows that the Drop Down list will close after the scroll bar has been clicked in order to go to a hidden portion of the list.  at just past halfway in the video I changed focus to the Kendo.textarea that contains "asdf" and then went back to the drop down list and it works as expected.   the exact same page will work fine in Chrome, Firefox, and IE 9.   If I select the text area first and then select the dropdown list it works as expected.

Thoughts?


Regards,
Jimm
Aaron
Top achievements
Rank 1
 answered on 05 Feb 2015
1 answer
774 views
How do you add a DropDownlist to Grid Toolbar that is already showing the built in Excel toolbar button.

@(Html.Kendo().Grid<Reports.ReportRow>()
    .Name("grdReport")
    .DataSource(dataSource => dataSource
        .Ajax()
        .Read(read => read
                .Action("AJAX", "Report")
                .Data("GetReportParms")
        )
    )
    .ToolBar(tools => {
        tools.Excel();
        tools.Template(@<text>
           <div class="toolbar">
                <label class="category-label" for="category">Version:</label>
                    @(Html.Kendo().DropDownList()
                        .Name("ddlField")
                        .DataTextField("Text")
                        .DataValueField("Value")
                        .AutoBind(true)
                        .Events(e => e.Change("fieldChange"))
                        .DataSource(ds =>
                        {
                            ds.Read("FieldType", "Common");
                        })
                    )
            </div>
        </text>);
    })

All the examples I can find show either a DropDownList in a Toolbar Template OR the built in Excel toolbar button.  I need both.

Thanks
Dimiter Madjarov
Telerik team
 answered on 05 Feb 2015
2 answers
777 views
I have a bunch of buttons that each bring up the same context menu.  I need the context menu to position itself at the mouse click on the button.

In ASP.NET this is accomplished by using code like this.

function OpenAddRowMenu(event) {
    var contextMenu =  $("#AddRowMenu");
    if ((!event.relatedTarget) || (!$telerik.isDescendantOrSelf(contextMenu.get_element(), event.relatedTarget))) {
        contextMenu.show(event);
    }
    else {
        alert("Event error");
    }
}

The button

<button class="btn btn-primary" onclick="OpenAddRowMenu(event); return false;">Add Row</button>
 
I cannot find anything on positioning a context menu or any possible parameters to show().  The MVC documentation is really thin and the examples only show so much.
George
Top achievements
Rank 2
 answered on 05 Feb 2015
1 answer
411 views
Hi there

We are using Kendo Charts in our application. We can successfully export the charts using the following jQuery.
$("#exportASPBarChart").click(function () {
    var chart = $("#ASPBarChart").data("kendoChart");
    var image = chart.imageDataURL();
    var a = $("<a>").attr("href", image).attr("download", "ASPBarChart.png").appendTo("body");
    a[0].click();
});
Is there a way to export the data to a Excel file?

Thank you.
Iliana Dyankova
Telerik team
 answered on 05 Feb 2015
1 answer
350 views
Hi,

I am trying to maintain state of kendo grid like Page Number,Page Size using session. I have referenced below example from your forum

http://www.telerik.com/support/code-library/save-grid-state-in-session-on-server-side

Problem is I don't have any button to Save or Load the grid state like above exmaple. 

I am saving the grid state on DataBound event of Grid and Loading the sate back from session in Document.ready function.

But its not working for me as  Index_Read function for Ajax binding of Grid  is always getting called first before LoadGridState function and thus session object is getting overridden with defualt values for pagesize, pageno etc.

Can you please help me on this.

Thanks
Aarti



Daniel
Telerik team
 answered on 05 Feb 2015
1 answer
244 views
I am having difficulty finding an example for binding the Kendo UI Grid for MVC 4 to a DataTable when using the ASPX view engine.

I reviewed the example in this forum http://www.telerik.com/support/code-library/binding-to-datatable-0191a594e359 and I am finding other examples using the Razor view engine.

Unfortunately, the MVC project to which I am assigned is very large and it is not a priority to convert to the Razor view engine at this time.  The priority is a conversion from MVC 2 to MVC 4 and it was expected the upgrade will go more quickly to stay with the ASPX view engine until a later date.

The requirements are
1. Stick with the ASPX view engine for now and 
2.  Upgrade the controls to work with MVC 4 (for this we are using the latest Kendo UI for MVC 4).

The binding scenario is to pull the DataTable from a session object called "GridResults" (That's right, it's not returned by the controller directly).

We also need to add the DataKeys to the grid when binding to the session-held DataSource.

If there are any examples of binding to a session DataSource returning a DataTable it would be appreciated.  Adding data keys would be a bonus.

Thank you
Atanas Korchev
Telerik team
 answered on 05 Feb 2015
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?