Telerik Forums
UI for ASP.NET MVC Forum
8 answers
743 views
Hi there, 

I am currently working on Kendo Grid. I have implemented with model binding from database. 
I have 3 windows. To add a row, to see the details, and to change the concern row. 

So far everything works.

Now if the logged user wants to change his grid, I allowed him to record its changes / customization on the grid.  
Again everything works fine. I record the grid's statements in my database.
To do this I Took example on this project :
http://www.telerik.com/support/code-library/save-grid-state-in-session-on-server-side

The problem is that when I load my save states, my add button disappears (Custom Toolbar), and none of my windows opens (edit, detail, this 2 buttons are Custom Command)

Do you have an idea for how to save the states of these elements? 

Thank you in advance, 


Ps : This is the javascript code I use to saved grid's states : 

<button id="save">Save state</button>

$("#save").click(function () {
    var grid = $("#Table").data("kendoGrid");
 
    var dataSource = grid.dataSource;
 
    var state = {
        columns: grid.columns,
        page: dataSource.page(),
        pageSize: dataSource.pageSize(),
        sort: dataSource.sort(),
        filter: dataSource.filter(),
        group: dataSource.group(),
    };
 
    $.ajax({
        url: "/Base/Save",
        data: {
            data: JSON.stringify(state)
        }
    });
});

I have a project to show you but it's between 8 and 9 MB when compressed.

Best regards.




Dimo
Telerik team
 answered on 24 Oct 2014
1 answer
104 views
Hi,

I manage to implement an hierarchical Kendo UI Grid successfully. However the specifications for the application that I'm building requires that the child grid be only displayed if the current user have the authorization.  How can I achieve this?

Alexander Popov
Telerik team
 answered on 24 Oct 2014
1 answer
353 views
Hi,

I am using the KendoUI Razor grid in my application with the following Settings :

@model BMS_RDM_DTO.SnapshotGridData
    @(Html.Kendo().Grid(Model.NewRecordsGridData)
        .Name("NewRecordsGrid")
    .Columns(columns =>
    {        
        columns.AutoGenerate(true);
        columns.Command(command => command.Custom("Edit").Click("EditNewRecordGrid")).Title("Actions");

    })
    .Filterable()
            .HtmlAttributes(new { style = "height: 380px;" })
                              .Scrollable(scroll => scroll.Enabled(true))
                .Groupable()
                .Sortable()
                .Pageable(pageable => pageable
                    .Refresh(true)
                    .PageSizes(true)
                    .ButtonCount(5))
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(10)
        .ServerOperation(false)
     ).Resizable(resize => resize.Columns(true))
)

I have an issue with the dateTime format shown on the grid. Please refer the screenshot - I dont want the UTC component to be shown. I would like to see just the date and the time without the offset / timezone difference.

What settings/config are required to achieve this  ? Can I set the date time formatting for the grid itself in the CSHTML ? (I can't set it for individual columns because autobind=true) 


Rosen
Telerik team
 answered on 24 Oct 2014
1 answer
155 views
Hi All,

I am using kendo tabstrip in my mvc application and used knockout js to bind data. The tabstrip is inside a kendogrid detail template. and data for all tab loads on detailrow init function of grid.When expanding detail row, first tab is active and it shows data. But when I select a different tab, it is showing empty content area. This issue comes in IE8.

Anyone have idea on why this happens?

Regards
Dimiter Madjarov
Telerik team
 answered on 24 Oct 2014
1 answer
76 views
Hi Team,

I am using kendo file upload control, but the UI for select file button is not working in IE8.It is showing empty button, without any label
Is there any solution for that?

Regards
Dimiter Madjarov
Telerik team
 answered on 24 Oct 2014
3 answers
792 views
Dear KendoUI Team!
Is it possible to realize s.th. like this with KendoUI when using AJAX Binding?

            columns.Command(commands =>
            {
                commands.Edit().ButtonType(GridButtonType.Image);
                commands.Delete().ButtonType(GridButtonType.Image);
                commands.Custom("CopyItem")
                    .Action("CopyItem", "Le")
                    .Ajax(true)
                    .HtmlAttributes(new { id = "CopyItemDetails" })
                    .DataRouteValues(route => route.Add(i => i.Rid).RouteKey("ItemID"))
                    .ButtonType(GridButtonType.Image)
                    ;

            }).Title(Strings.Commands).Visible((bool)ViewData["Writable"]);
What I found is that the custom command should be replaced by a column template. But I want the copy command in the command column, not in a separate column. And I need the ItemID of the row, of course.
How can I realize this with KendoUI?

brgds
Malcolm Howlett
wortho
Top achievements
Rank 2
 answered on 23 Oct 2014
15 answers
4.7K+ views
Hello, I am not sure if I have this right, but I have a grid with multiple records in it. I have added a checkbox to the grid so that the user can select the records they want to update.  What I want to happen is for selected records to be updated with a value selected in a combobox from the form. I have the checkboxes displaying fine on the grid with this line of code.

 columns.Template(@<checked>@Html.CheckBox("selected", new { id = @item.ID })</checked>).Title("Select");

the problem is when the update button is clicked I do not know how to iterate through the rows in the kendo grid from the controller and grab those records that will be updated .

I tried something like this but cant get it to work "Cannot convert type char....

foreach (GridRow<Bin_BudgetView> row in fc["kendoGrid"])

Can someone please give me a simple solution to iterate through a kendo grid from the controller and update those records that are checked?

Also If I wanted to check or uncheck all of the records in the grid how would I go about that?

thanks for your help

Paul
Rosen
Telerik team
 answered on 23 Oct 2014
1 answer
102 views
I have put together a simple app which include a few or the "out-of-the-box" index views. I would like to swap the table in these views for the Telerik grid.

I have the following action in the controller:

// GET: Assets
public ActionResult Index()
{
     
    var assets = db.Assets.Include(a => a.Equipment).Include(a => a.Owner).Include(a => a.ServiceCompany).Include(a => a.Site);
     
    return View(assets.ToList());
}

I have swapped out the table code and copied the following from the demo

@(Html.Kendo().Grid(Model)
    .Name("Grid")
    .Columns(columns =>
    {
        columns.Bound(p => p.Site).Title("Site").Width(130);
        columns.Bound(p => p.Location).Title("Location").Width(130);
        columns.Bound(p => p.Description).Title("Decriptopn").Width(130);
        columns.Bound(p => p.InstallDate).Title("Install Date").Width(130);
        columns.Bound(p => p.SerialNo).Title("Serial Number").Width(130);
    })
    .Pageable()
    .Sortable()
    .Scrollable(scr => scr.Height(430))
    .Filterable()
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(20)
        .ServerOperation(false)
     )
)


When I try to view the 

System.InvalidOperationException was unhandled by user code
  HResult=-2146233079
  Message=A circular reference was detected while serializing an object of type 'System.Data.Entity.DynamicProxies.Asset_ED2530D1AC046011EB9F014D634FE570012E36DD19818476965A4BF61659B91A'.
  Source=System.Web.Extensions
 
I changed the HTML helper line to

@(Html.Kendo().Grid<AMScan.Models.Asset>()

which then rendered the grid on the page without the exception however there was no data.

Can you please tell me what I am doing wrong.
Dimiter Madjarov
Telerik team
 answered on 23 Oct 2014
3 answers
378 views
Given the following data model:

     Product
          Id (int)
          Name (string)
          VapourPressure (double)
          Components (IEnumerable<Component>)

      Component
          Id (int)
          Name (string)

I want to create a grid using these that displays the data. In this case Name, VapourPressure, Components. The components should be displayed in a HTML list. Of course I want to be able to filter on the presence of 'components' in the Components.

My current code is attached.

I have got displaying the components working, although I needed a workaround because any '+' characters are stripped from the template parameter. If there is another way to do this I would like to hear it.

What I don't have working is the filtering on components. First of all the drop down doesn't work correctly because the options loaded from AJAX are not shown. If the dropdown is instantiated outside the grid everything works fine.  How do I get the dropdown working?
Alexander Popov
Telerik team
 answered on 23 Oct 2014
2 answers
218 views
For anybody who finds this problem, the fix is to add the following line to the bundleconfig.cs file:

bundles.IgnoreList.Ignore("*.unobtrusive-ajax.min.js", OptimizationMode.WhenDisabled);


This will prevent the unobtrusive ajax script from loading twice (i.e. the minified and non-minified) in debug mode, which is what causes the double postback.

Alternatively, just remove the non minified script from the project (this obviously has implications for debugging, if you're inclined to debug the scripts included in the project template).

Telerik - this ought to be included in your how-to guide.
Sebastian
Telerik team
 answered on 23 Oct 2014
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?