Telerik Forums
UI for ASP.NET MVC Forum
5 answers
532 views

Hello,

I currently have an ASP.NET MVC application that is primarily composed of a hierarchical grid and custom edit templates. I want to display a simple error page to indicate a failed database operation to the user.

I tried a standard approach adding the following to the Web.Config file: 

<customErrors mode="On"></customErrors>

I also added the following attribute at the beginning of my controller classes:

[HandleError(ExceptionType = typeof(DbUpdateException), View = "Error")]

The error page, Error.cshtml is located in the Views/Shared directory of the application.

I cannot get this to work. I can't even view the error page in the browser. I get a 404 error when I right click on the file and select view in browser.

Are there any general error handling guidelines for Telerik UI for ASP.NET MVC? I looked, but couldn't find anything fairly recent. If any such guidelines / documentation exists, where would I find it?

Thanks

Ianko
Telerik team
 answered on 14 May 2020
1 answer
396 views

I have a treeView with multiple hierarchy, and only leaf/last node should have checkbox, not any parent should have checkbox.

I have refered many threads and examples. Tried Checkboxes Template but that makes another issue that values did not get binded with checkbox.
I need treeview like (https://jsbin.com/edamuj/131/edit?html,output)

 

 

@(Html.Kendo().TreeView()
                                .Name("treeview")
                                .Events(e => e.Select("OnSelectTree").DataBound("OnDataBound")).ExpandAll(true)
                                .Checkboxes(checkboxes => checkboxesName("checkedFiles"))
                                .BindTo((List<DPS.Model.ReviewDocumentTreeViewItemModel>)ViewBag.DocumentTreeData, (Kendo.Mvc.UI.Fluent.NavigationBindingFactory<TreeViewItem> mappings) =>
                                {
                                    mappings.For<DPS.Model.ReviewDocumentTreeViewItemModel>(binding => binding.ItemDataBound((item, category) =>
                                    {
                                        item.Id = category.Id;
                                        item.Text = category.Name;
                                        item.Selected = category.IsSelected;
                                        item.HtmlAttributes.Add("data-allowselection", category.AllowSelection);
                                        item.Expanded = true;
                                        item.Checked = category.IsReviewed;
                                    }).Children(g => g.Items));
                                }))


Aleksandar
Telerik team
 answered on 14 May 2020
1 answer
1.1K+ views

Hello EveryOne,

I'm trying to change the dataSource of a MultiSelect widget.

This is my MultiSelect (in my CustomEditor):

@(Html.Kendo().MultiSelectFor(model => model.Person)
                         //.Name("FirmaAutoSelect")
                         .DataTextField("Name")
                         .MaxSelectedItems(1)
                         .AutoWidth(true)
                         .HtmlAttributes(new { style = "width:100%" })
                         .Events(eve =>
                         {
                             eve.Open("onOpen_Person");
                         })
                         //.ValuePrimitive(true)
                         .DataSource(source =>
                         {
                             source.Custom()
                             //.ServerFiltering(true)
                             .Type("aspnetmvc-ajax")
                             .Transport(transport =>
                             {
                                 transport.Read("Read_Personen", "Person");
                             })
                             .Schema(schema =>
                             {
                                 schema.Data("Data")
                                         .Total("Total")
                                         .Errors("Errors");
                             });
                         })
                    )

 

and i tried in the onOpen_Person function this code :

var person_mult = $("#Person").data("kendoMultiSelect");
                    var dataSource = new kendo.data.DataSource({
                        //batch: true,
                        transport: {
                            read: {
                                url: "/Person/AlleOderFirma_Personen",
                                dataType: "json"                           
                            },
                    //    }
                    //});
                            parameterMap: function (options, operation) {
                                if (operation !== "read" && options.models) {
                                    return { models: kendo.stringify(options.models) };
                                }
                            }
                        },
                        schema: {
                            model: {
                                id: "Sid_personen",
                                fields: {
                                    Sid_personen: { from: "Sid_personen" }
                                }
                            }
                        }
                    });
                    person_mult.setDataSource(dataSource);

 

Now this shows just one item and it's undefined !!

I console.Logged the dataSource and i saw that the "Sid_personen" is undefined .. but in "_data" i found all the items i need .. but it doesn't show them ..

in the attached picture you can see the consoleLogged DataSource.

and this is my ActionMethod:

public ActionResult AlleOderFirma_Personen([DataSourceRequest]DataSourceRequest request)
{
    //string g = Id_Firma;
    using (var db = new cRM_FM_v2_KARAMEntities())
    {
        IQueryable newQuery = db.PERSONEN.ToList().Select(prs => new PersonViewModel()
        {
            Sid_personen = prs.SID_PERSONEN,
            Name = prs.NAME,
            Vorname = prs.VORNAME,
            Recid_firmen = prs.RECID_FIRMEN,
            Crmusername = prs.CRMUSERNAME
        }).AsQueryable();
        return Json(newQuery.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
    }
}
Martin
Telerik team
 answered on 14 May 2020
4 answers
1.0K+ views

Hello,

I'm using a dropdown list to display a list of campaigns for a user to choose from. The dropdown list is part of a custom editor template for adding/editing donations. The campaigns are stored in a separate table, that has no cardinal relationship with the underlying donations table used by the template. In this  use case scenario, the campaign table is being used as a lookup. The donation table simply stores the campaign name, nothing else is required beyond that, so no relationship is required.

The campaigns are being stored in a separate table because campaigns are often edited, added, or deleted independent of the rest of the application. There are also too many of them to either hard code or include in the markup.

For some reason, I'm not able to retrieve the data from the campaign table, something I thought would be pretty straightforward.

I'm including a .zip file containing the following relevant files:

Models

Donation.cs 

Campaign.cs 

Controllers

DonationsController.cs

CampaignController.cs

 

Custom Editor Template

DonationTemplate.cshtml

 

I'm not sure what I've done wrong here. This seems like it should pretty straightforward. Any advice/feedback would be very much appreciated.

 

Thank you!

 

 

 

Marcab
Top achievements
Rank 1
Veteran
 answered on 13 May 2020
2 answers
615 views

 

I have a Grid with the search and filters enabled.  I have placed the sprite files where they are supposed to go and still the buttons do not come up.  What do I have to do to get the filter and search buttons to display?  Is there a guide somewhere that explains what I need to do?  I need for these buttons to display.
Christine
Top achievements
Rank 1
Veteran
 answered on 13 May 2020
6 answers
2.9K+ views
I have a form which will input a date time range and it will return a list of object, I want that list of object to be the datasource of my multi select, how do I do that? I am using asp. net mvc, what is the best approach? I am using jquery and ajax for my api calls.
Misho
Telerik team
 answered on 13 May 2020
3 answers
683 views
Hi, is there an example somewhere of how to draw a shape on the map?
Alex Hajigeorgieva
Telerik team
 answered on 12 May 2020
4 answers
199 views
Is it possible to draw shapes on the map with a mouse?  I do not see mouse events exposed for the map or shape layer.
Viktor Tachev
Telerik team
 answered on 12 May 2020
1 answer
61 views

Bom dia, eu tenho uma grid dentro de um popup, esse popup recebe uma model com 5 propriedades e uma lista "opcoes". Eu gostaria de saber como populo essa grid com essa lista da model. Tentei conforme o codigo abaixo, mas sem sucesso.

 

        @(Html.Kendo().Grid<Entidades.OpcaoPerguntas>(Model.Opcoes)
            .Name("gridOpcao")
            .Columns(columns =>
            {
                columns.Bound(o => o.CodigoOpcao).Visible(false);
                columns.Bound(o => o.Ordem).Visible(false);
                columns.Bound(o => o.DescricaoOpcao).Title("Descrição da Opção");
                columns.Bound(o => o.DescricaoDivisor).Title("Divisor");
                columns.Bound(o => o.DescricaoTipoOpcao).Title("Tipo de Opção");
                columns.Bound(o => o.Meta);
                columns.Bound(o => o.Pontos);
            })
            .Sortable()
            .DataSource(dataSource => dataSource
                .Ajax()
                .Batch(true)
                .ServerOperation(false)
                .Model(m => m.Id(i => i.CodigoOpcao))
)

            )

Nikolay
Telerik team
 answered on 12 May 2020
5 answers
337 views
I have a Grid for a strongly typed model with a DateTime property CreateDate.
Html.Kendo().Grid<Department>()
When editing a row, it posts the DateTime back to the server in the following format:
CreateDate:Thu Jul 11 2013 11:54:13 GMT-0500 (Central Daylight Time)
It posts to the following Controller action:
public ActionResult UpdateDepartment([DataSourceRequest] DataSourceRequest request, Department department)

.Net automatically binds the other values sent across, but if fails when parsing the CreateDate with the following message:

The value 'Mon Jul 08 2013 08:50:16 GMT-0500 (Central Daylight Time)' is not valid for CreateDate.

My culture is the default en-US.

I found a forum post where someone has a similar issue. (http://www.kendoui.com/forums/kendo-ui-framework/globalization/datasource-date-format-incompatibile-with-asp-net-mvc-date-format.aspx#Z6fZydEt5E63AuZr05gjLQ)

Is there a solution that allows Kendo and .Net to automatically bind the model?

I have a workaround, and I realize I could use a custom model binder. However, both solutions are less than optimal.
Ivan Danchev
Telerik team
 answered on 11 May 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?