Telerik Forums
UI for ASP.NET MVC Forum
4 answers
379 views

I have a simple form:

@Model MyViewModel

<form method="post" action='@Url.Action("Submit")'>

    <div class="demo-section k-content">

        @Html.TextBoxFor(x => x.SomeRequiredField);

        @(Html.Kendo().Upload() .Name("files") .HtmlAttributes(new { aria_label = "files" }) )

        <p style="padding-top: 1em; text-align: right"><input type="submit" value="Submit" class="k-button k-primary" /></p>

    </div>

</form>

 

public ActionResult Submit(MyViewModel vm, IEnumerable<HttpPostedFileBase> files){

    if(ModelState.Valid) {

        ... do stuff

    } else {

        return View(vm);

    }

}

 

If I select a bunch of files in my upload control, and push the Submit button, suppose validation failed and the view is posted back, however my selected files are lost and I have to reselect them.

How do I restore the previously selected files in the file upload control (synchronous mode) when the form fails validation and is posted back?

 

Nencho
Telerik team
 answered on 15 Oct 2018
1 answer
142 views

The grid ignore case sensitive by default. But when i try to export excel by server side, the datas are filtered but without ignoring the case.
Any thing to do ?

 

 @(Html.Kendo().Grid(Model)
        .Name("grid")
        .ToolBar(toolbar =>
        {
        toolbar.Template(@<text>
            <a class='k-button k-grid-export' title='Export to XLS'>Export vers Excel</a>
        </text>);
        })
        .Columns(columns =>
        {

      columns.Bound(prat => prat.FirstName);
            columns.Bound(prat => prat.LastName);

}

.ColumnMenu()

.Groupable()
.Excel(excel => excel.FileName("Stat.xlsx").Filterable(true).AllPages(true))
.DataSource(dataSource => dataSource
            .Ajax()
            .Model(model => model.Id(p => p.GUIDReference))
            .Read(read => read.Action("DataRead", "BackOffice"))
            .ServerOperation(false)
            )

 

$(".k-grid-export").on("click", function (e) {
            exportToExcel('XLSX');
        });

 function exportToExcel(format) {
            var grid = $("#grid").data("kendoGrid");

            var filteredDataSource = new kendo.data.DataSource({
                data: grid.dataSource.data(),
                filter: grid.dataSource.filter(),               
            });

            filteredDataSource.read();
            var filteredData = filteredDataSource.view();

            var exportOption = {
                format: format,
                title: "Export",
                createUrl: "/BackOffice/Export",
                downloadUrl: "/BackOffice/Download"
            }

            data = {                
                model: JSON.stringify(grid.columns),
                data: JSON.stringify(filteredData.toJSON()),
                format: exportOption.format,
                title: exportOption.title
            };

            $.post(exportOption.createUrl, data, function () {
                window.location.replace(kendo.format("{0}?format={1}&title={2}",
                    exportOption.downloadUrl,
                    exportOption.format,
                    exportOption.title));
            });
        }

Tsvetina
Telerik team
 answered on 15 Oct 2018
2 answers
297 views

I am trying to implement a DropDownTree on a Grid Editing Popup.

 

1: I am unable to make the DefaultValue work. I am using an ID Like so: m.Field(p => p.treeID).DefaultValue(3)

2: Selecting another value in the tree does not seem to change the value in the related Grid Cell.

 

Veselin Tsvetanov
Telerik team
 answered on 15 Oct 2018
2 answers
857 views

I am a little surprized to see that the dropdowntree selects values with string values rather than with id's. 

 

What if you have the same string value more than once in the tree?

 

How can I set the value of the dropdowntree with an id?

Veselin Tsvetanov
Telerik team
 answered on 15 Oct 2018
9 answers
1.6K+ views
Is it possible to change the CSS for the Kendo menu only? Looking at this doco: http://docs.kendoui.com/getting-started/web/appearance-styling, I see that the k-header class will change the top level menu - but it also affects other controls.  I also see the k-state- classes.  I only want to change the menu, and its hover and selected states. Is this possible?
Dimo
Telerik team
 answered on 12 Oct 2018
3 answers
97 views
View HTML changes bold in strong, italic in em

When I edit teks in html view and add a <b>, it changes into <strong>.
When I add a <i> it changes to <em>
etc

I can not add properties to .Viewhtml() , how can i makes sure it will hold its values as I have entered?
Veselin Tsvetanov
Telerik team
 answered on 12 Oct 2018
10 answers
3.4K+ views

I have a page that contains a parent grid and a child details grid.  The parent grid uses popup editing and I can control the maxLength of the edit fields on the dialog.  However, the child details grid allows inline editing and one of the fields ("Code") can only be a length of 3 digits.

I have seen other posts and examples using the .attr to set the element's maxlength, but this does not seems to work.

So, within my details grid there is a column called 'Code'.  Inspecting the element while viewing the page in Chrome, shows the edit field to be an <input> element with and Id = 'Code' and Name = 'Code'.  I have tried the following jquery within the DataBound event of the details grid.  I also tried this in the document.ready function.

 

$("#Code").attr('maxlength', '3');

and

$("input[name='code']").attr('maxlength', '3');

 

Any chance of getting this as part of the grid declaration, possibly along with the column.Bound()?

 

Thanks,

Shawn

Georgi
Telerik team
 answered on 11 Oct 2018
1 answer
352 views

Is there a way to make something like this with MVC controls or Kendo UI :

https://demos.telerik.com/aspnet-ajax/fileexplorer/examples/client-sideapi/fileselectordialog/defaultcs.aspx

 

Thanks for your help.

 

 

Veselin Tsvetanov
Telerik team
 answered on 11 Oct 2018
1 answer
98 views

Hi,

 

When I upload a file using the Upload control, I want to be able to change the name of the file on the server, but I want the user to see the original file name.

 

Is there a way to have a different name and value for each file in the list? If so, how is the value set?

 

Thanks,

Jess

Ivan Danchev
Telerik team
 answered on 11 Oct 2018
2 answers
98 views

I apologize if this is a silly question but is it possible that a single grid that has the inline editing capabilities for logged in users and just a read only grid for everyone else? If so where do I start?

Looking at the demo I thought I would have to create 2 grids and password-protect the one with inline-editing.

 

Thanks in advance

Rob
Top achievements
Rank 1
 answered on 10 Oct 2018
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?