Telerik Forums
UI for ASP.NET MVC Forum
1 answer
271 views

We are using a pretty standard grid in an ASP.NET MVC application, and are using the built-in filtering offered by the control. When we filter our data using brackets ([) or braces ({) (as some our data is in the format [My Name] or My Name{#2}), and Export to Excel, we end up with an empty spreadsheet. Other special characters seems to work correctly (_, *, #, etc). Is there a way I can get these characters to work when included in a filter? When exporting all rows, these bracket- and brace-containing entries appear as expected, so they are not being excluded from the grid because of the special characters.

 

Thanks,

Jim

Stefan
Telerik team
 answered on 03 Oct 2017
4 answers
2.1K+ views

Following problem: I've got a "detail" grid as element of a ClientDetailTemplate of a "master" grid. One column ("IsActive" in this example) in the detail grid should get a ClientTemplate, whose value is dependent on a property from the detail grid's data:

@(Html.Kendo().Grid<MasterEntity>()
    .Name("masterGrid")
    .Columns(columns =>
    {
        ...
    })
    .ClientDetailTemplateId("detailsTemplate")
    .DataSource(...))
)

<script id="detailsTemplate" type="text/kendo-tmpl">
    @(Html.Kendo().Grid<DetailEntity>()
        .Name("detailGrid_#=Id#")
        .Columns(columns =>
        {
            columns.Bound(p => p.IsActive).ClientTemplate("#= IsActive #");
        })
        .DataSource(...)
        .ToClientTemplate()
    )
</script>

 

Unfortunately, the expression "#= IsActive #" in the detail template cannot be evaluated correctly. The "scope" for the template is set to the master grid - thus I can add an expression to a property of the master grid, but not the detail grid. How can I achieve to set a ClientTemplate for the detail grid column with property expressions to the client grid data?

 

Thanks, Dimitrij

Stefan
Telerik team
 answered on 03 Oct 2017
6 answers
2.3K+ views

Hi,

I would like to have a button on toolbar in grid and then by clicking on the button the pup up appears. Then It provides opportunity to add new raw in the grid (insert information in sql server). I am not sure which ways are better, using 1.toolbar.Create() or 2.toolbar.custom()?

1. if I use toolbar.Create().Text("default add"), I have Create(create => create.Action("AddNewSample", "MyController", new { model = "#=MyModel#" })) in DataSource.

Then, I have the popup, but I don't know how I can add information through Update button. It seems it does not call the function in controller.

here is my controller:

public ActionResult AddNewSample(long? A, string B, string C, DateTime D)
        {
            if (ModelState.IsValid)
            {
                db.Sp_Sample_Ins(A, B, C, D);
             } 

            return View("Index");
        }

 

2. But If I use toolbar.Custom(), I should create pop up window myself. so I have toolbar.Custom().Text("Add New Sample").HtmlAttributes(new { id = "customCommand" });

and in JavaScript I tried to follow this:

http://demos.telerik.com/aspnet-mvc/grid/custom-command

Preferably, I would like to have a template in another page(not on my Grid's page).

but I dose not work.

I appreciate any suggestion and help.

 

Stefan
Telerik team
 answered on 03 Oct 2017
3 answers
247 views

When using this code from the server import/export demo, hidden rows get expanded to the default width, while using the frontend excel export preserves the row height

[HttpPost]
        public ActionResult Download(string data, string extension)
        {
            var workbook = Workbook.FromJson(data);
            using (var stream = new MemoryStream())
            {
                workbook.Save(stream, extension);
 
                var mimeType = Telerik.Web.Spreadsheet.MimeTypes.ByExtension[extension];
                return File(stream.ToArray(), mimeType, "Exported" + extension);
            }
        }
Joana
Telerik team
 answered on 02 Oct 2017
3 answers
723 views

We just upgraded to the latest 2017.3.913 to fix an issue where we couldn't get a good PDF export (AllPages() wasn't working) from a grid with server paging.  That problem was corrected with the update but now we have another PDF export issue.  We have a grid that has row detail grids and is NOT using server side paging.  When the user clicks export, we use the PDF export event to expand all of the detail grids and change the number of rows per page to a large number so that all records will be exported along with the row details.

function onPdfExport(e) {     

    var grid = e.sender;     

    var pageSize = grid.dataSource.pageSize();     

    grid.dataSource.pageSize(5000);     

    grid.refresh();     

    grid.expandRow(this.tbody.find("tr.k-master-row"));     

   e.promise         

        .done(function () {             grid.dataSource.pageSize(pageSize);             grid.refresh();         });

}

The problem we're having happens whether we are using this code to expand all rows OR if we comment out the code and expand a few manually.  If I expand 3 rows, the export is combining the details for each row and showing the detail data for all open rows in all open rows.  I know that is a little difficult to understand...if each of the 3 rows that have been expanded have 1 detail row each then 3 detail rows will export under every expanded row.  See attached images for a clearer description.  These images were generated without the use of the PDF export event handler defined above.  I manually expanded 3 rows before exporting.  The first screenshot is the actual grid showing 3 rows expanded.  The second is the page from the PDF export where you can see that the detail grids are combined.

 

 

Konstantin Dikov
Telerik team
 answered on 02 Oct 2017
3 answers
86 views

I have a grid that I am loading with a linq query to my database.  On page load it works great and returns dated now + 21 days.  The users need to ability to then enter there own dates to search between.  It is all working great right up to the point the data returned from the controller needs to get into the grid.  It just won't load.

Relevent code of grid

.DataSource(dataSource => dataSource
    .Ajax()
    .PageSize(20)
    .Read(read => read
        .Action("Action", "Controller")
        )
    .Sort(sort =>
    {
        sort.Add(p => p.ID).Ascending();
        sort.Add(p => p.Date).Ascending();
    })
    .Group(g =>
    {
        g.Add(c => c.ID);
    })
    .ServerOperation(false)
)

 

When the user enters 2 dates and clicks search the function is run.  The grid is cleared and a loading message appears goes away and the grid remains blank.

function onClickSearch() {
    var fromDate = $("#startDate").data("kendoDatePicker").value(),
        toDate = $("#endDate").data("kendoDatePicker").value();
    $("#prodReadiGrid").data("kendoGrid").dataSource.read({ "start": fromDate, "end": toDate});
}

 

When I debug I see the controller sending the view the grid, it just does not load.

 

Any ideas?

Georgi
Telerik team
 answered on 02 Oct 2017
4 answers
997 views

Hi,

MultiSelect Tag Template selected value with comma separate in input field.

Is it available in document? If not could you send sample code how to set selected value with comma separate.

Regards
Suman

 

Suman
Top achievements
Rank 1
 answered on 01 Oct 2017
2 answers
843 views

I am able to populate Editor programmatically from my model using Alexander's code snippet from http://www.telerik.com/forums/how-do-i-set-the-value-to-a-model-value-in-a-template-7d3339946e0d.

However, when I try to populate editor using an Ajax call (based on a selection in a dropdownlist), then it stops working.  I can see the correct values are being returned and my other bound fields are populating correctly, just not the Editor textarea.

My editor:

@(Html.Kendo().EditorFor(m => m.Content)
      .Name("Content")
      .HtmlAttributes(new { style = "height:650px", aria_label = "editor" })
 )

and my Jquery:

$(function () {
        $('#Name').change(function () {
            var name = $(this).val();
 
            var success = function (results) {
                debugger;
                $('#Id').val(results.Id);
                $('#Name').val(results.Name);
                $('#NewName').val(results.Name);
                $('#Content').val(results.Content);
            };
 
            $.ajax({
                url: '/Staff/Email/GetEmail',
                type: 'POST',
                data: {
                    name: name
                },
                dataType: 'json',
                success: success
            });
        });
    });

 

The textarea has an id of 'Content', so why can't I set it's value using Jquery?

 

Thank you in advance,

Laura

Laura
Top achievements
Rank 1
 answered on 29 Sep 2017
3 answers
199 views

Maybe I am missing documentation if such a feature exists but is it possible to display some kind of indication on a column header to identify that particular column has an active filter?

When sorting a column it can display an up arrow or down arrow which indicates active sorting on that column. Is there an equivalent for active filter?

 

Erik
Top achievements
Rank 1
 answered on 29 Sep 2017
2 answers
6.5K+ views
Hello,
I am looking for information on how to add a dropdown box to an MVC specific grid control. I need the box to display in a cell and show when the grid is rendered. Do you know of a sample or have example code available?

Thanks 
Viktor Tachev
Telerik team
 answered on 29 Sep 2017
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
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
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?