Telerik Forums
UI for ASP.NET MVC Forum
10 answers
1.5K+ views
Hi,

I am using the PopUp mode in the Kendo Grid Widget. I have two Problems.

1. The @Html.DisplayFor command generates no text, when I use @Html.TextBoxFor it works as expected but the Twitter Bootstrap formatting does not work.

@model NursingHomeStock.Models.PlaceTypeViewModel

<div class="form-horizontal">
    <div class="form-group">
        @Html.LabelFor(m => m.Name, new { @class="col-xs-3 col-sm-3 col-md-3 col-lg-3 control-label"})
        <div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
            @Html.TextBoxFor(m => m.Name, new { @class = "form-control" })
            <p class="form-control-static">Text: @Html.DisplayFor(m => m.Name)</p>
        </div>
    </div>
    
    <div class="form-group">
        @Html.LabelFor(m => m.ForDate, new { @class = "col-xs-3 col-sm-3 col-md-3 col-lg-3 control-label" })
        <div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
            @(Html.Kendo().DateTimePickerFor(m => m.ForDate)
                  .Name("ForDate")
                  .Format("yyyy-MM-dd hh:mm:ss")
                  .Interval(15)
                  )
        </div>
    </div>
    
    <div class="form-group">
        @Html.LabelFor(m => m.Comment, new { @class = "col-xs-3 col-sm-3 col-md-3 col-lg-3 control-label" })
        <div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
            @(Html.TextAreaFor(m => m.Comment, new { rows = 6, @class = "form-control" }))
        </div>
    </div>
</div>

2. I have a scrollbar at the bottom of the window, the components should be smaller to fit into the popup, how can I achieve this?







Preslav
Telerik team
 answered on 18 Dec 2018
1 answer
307 views

I am following the directions for batch editing mode here:
https://demos.telerik.com/aspnet-mvc/grid/editing

When I disable server operation, I assume I am getting a LOT of records back from the database (50K+) and this is causing the following error: Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.

How can I use ServerOperation for Paging/Sorting/Filtering functionality, but still use Batch with InCell editing mode?

Controller Code:

public ActionResult Contacts_Read([DataSourceRequest]DataSourceRequest request)
       {
     
           var dbcontext = new CRMDataModel2();
           IQueryable<vw_CRM_GetCompanyContacts> contacts = dbcontext.vw_CRM_GetCompanyContacts;
 
       
           DataSourceResult result = contacts.ToDataSourceResult(request, contact => new {
               Comp_Secterr = contact.Comp_SecTerr,
               PersonLinkId = contact.PersonLinkId,
               Office = contact.Office,
               Company = contact.Company,
               Year = contact.Year,
               Branch = contact.Branch,
               Supervisor = contact.Supervisor,
               AccountManager = contact.AccountManager,
               Contact = contact.Contact,
               Role = contact.Role,
               NPS = (bool)contact.NPS,
               Statement = (bool)contact.Statement,
               Invoices = (bool)contact.Invoices,
               FieldReport = (bool)contact.FieldReport,
               RainContact = (bool)contact.RainContact,
           });
 
           return Json(result);
       }
 
View Code:
//grid is set to incell editing
 .Edtable(editable => editable.Mode(GridEditMode.InCell))
 
 //data source is set to server operation false, batch true
DataSource(dataSource =>
            dataSource.Ajax()
            .ServerOperation(false)
            .Batch(true)
            .Read(read => read.Action("Contacts_Read", "ContactMaintenance"))
            .Update(update => update.Action("Contacts_Update", "ContactMaintenance"))
            .Destroy(destroy => destroy.Action("Contacts_Destroy", "ContactMaintenance"))
//...omitted for brevity
Georgi
Telerik team
 answered on 18 Dec 2018
2 answers
737 views

i notice that my multi-select filter on my grid does not have a Select all checkbox as I have seen in the multi-filter checkbox demo -

I am using the asp.mvc version visual studio version 15.8.1 - 

To see this, create new telerik mvc core project using the grid template

which has this grid

<div class="row">
<div class="col-xs-18 col-md-12">
@(Html.Kendo().Grid<TelerikAspNetCoreApp1.Models.OrderViewModel>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.OrderID).Filterable(false);
columns.Bound(p => p.Freight);
columns.Bound(p => p.OrderDate).Format("{0:MM/dd/yyyy}");
columns.Bound(p => p.ShipName);
columns.Bound(p => p.ShipCity);
})
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.HtmlAttributes(new { style = "height:550px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Orders_Read", "Grid"))
)
)
</div>
</div>

 

add this to the freight column

Filterable(ftb => ftb.Multi(true))

the resulting filter has no select all checkbox as shown in this demo

https://demos.telerik.com/aspnet-mvc/grid/filter-multi-checkboxes

 

can you look into this and see what is going on

 

thanks

 

Jim

 

 

 

James
Top achievements
Rank 1
 answered on 17 Dec 2018
3 answers
361 views

Hi,

I've spent my whole day searching for a way of reloading a scheduler's resources and data from a javascript function. So far I've reduced my code to:

var scheduler = $("#MyScheduler").data("kendoScheduler");
  
scheduler.resources[0].dataSource.read();
scheduler.dataSource.read();

 

My code calls the correct methods against the controller and the new data is returned. However, the new resources are not displayed correctly. A very similar problem found here: https://www.telerik.com/forums/modifying-resources-datasource-dynamically.

As stated in the above post, "modifying the scheduler resources after it's initialization is not supported". It's also recommended that the scheduler should be destroyed and re-initialize. Nencho also provides a link to http://dojo.telerik.com/egoq which shows a jQuery method of doing so. 

can someone provide me with an MVC example of doing so?

I've got a horrible feeling that I need to call the action methods in the controller manually. There must be a better way...

Here's my RazorView set up of my .

@(Html.Kendo().Scheduler<AlternativeViewModel>()
    .Name("AlternativeScheduler")
    .Date(Model.TargetDate.GetValueOrDefault(DateTime.Today).Date)
    .StartTime(new DateTime(2015, 03, 31, 00, 00, 00))
    .EndTime(new DateTime(2015, 03, 31, 23, 59, 59))
    .Selectable(true)
    .MajorTick(1440)
    .MinorTickCount(1)
    .AllDaySlot(true)
    .CurrentTimeMarker(false)
    .Height(720)
    .EventTemplate(
        "<div style=text-align:center> " +
            "<p style='margin-top: 4px'>#= title #</p>" +
            "<p>" +
                "#= kendo.toString(ShiftStart, 'HH:mm') # - #= kendo.toString(ShiftEnd,'HH:mm') #" +
            "</p>" +
        "</div>")
    .Editable(editable =>
    {
        editable.TemplateId("SchedulerEditorAlt");
        editable.Destroy(false);
    })
    .Views(views =>
    {
        views.TimelineWeekView(timeline => timeline.EventHeight(80).Title("Week").Selected(true))
            .Footer(false)
            .ShowWorkHours(false)
            .DateHeaderTemplate("#=kendo.toString(date, 'ddd dd MMM')# ");
    })
    .Timezone(Model.TimeZone)
    .CurrentTimeMarker(c => c.UseLocalTimezone(false))
    .Group(group => group.Resources("ServiceName").Orientation(SchedulerGroupOrientation.Vertical))
    .Events(e =>
    {
        e.ResizeEnd("Roster.onResizeEndAlt");
        e.Edit("Roster.onEditEventAlt");
        e.Save("Roster.onSaveAlt");
        e.Cancel("Burger.onClose");
        e.DataBound("Burger.onAltDataBound");
        e.MoveEnd("Burger.onMoveEndAlt");
        e.Navigate("Burger.onAltNavigate");
        e.Change("Burger.onSchedulerChangeAlt");
    })
    .Resources(resource => resource
        .Add(m => m.ShiftPatternId)
        .Title("ServiceName")
        .Name("ServiceName")
        .Multiple(true)
        .DataTextField("ServiceName")
        .DataValueField("ShiftPatternId")
        .DataColorField("Color")
        .DataSource(source => source
            .Read(read => read
                .Action("GetServiceNames", "Scheduler").Type(HttpVerbs.Post)
                .Data("Burger.getSchedulerDataWithFormat")
            )
        )
    )
    .Resources(resource => resource
        .Add(m => m.Status)
        .Title("ShiftStatusId")
        .Name("Status")
        .DataTextField("WorkerName")
        .DataValueField("BurgerStatusId")
        .DataColorField("Color")
        .DataSource(source => source
            .Read(read => read
                .Action("GetShiftStatusResources", "Scheduler")
                .Data("Burger.getSchedulerDataWithoutDateCheck")
            )
        )
    )
    .DataSource(d => d
        .Model(m =>
        {
            m.Id(f => f.XmlId);
            m.Field(f => f.ServiceName).DefaultValue("No title");
            m.Field(f => f.SuggestedUserName);
            m.Field(f => f.Status);
        })
        .Read(read => read
                .Action("AlternativeSchedulerRead", "Scheduler")
                .Data("Burger.getSchedulerDataWithoutDateCheck")
        )
        .ServerOperation(true)
     )
)

Thanks in advance,

Paul

Paul Ridden
Top achievements
Rank 1
Veteran
 answered on 17 Dec 2018
23 answers
617 views

I have a VS2013 telerik mvc project and I have added a Class Library Project which has my DB models. I have already add the reference to my telerik mvc project but when I select the Kendo UI Scaffolding and select one of muy models inside de Class Library Project it always says: 

'There was an error running the selected code generator 'Invalid Model Configuration'

but I don't know what I'm missing. I'm using entity framework 5.0.0 with as the model generator.

 If someone has any idea I'll appreciate it.

Llorenç
Top achievements
Rank 2
 answered on 17 Dec 2018
1 answer
199 views
How do I set the scheduler date to current date in telerik? I have attached screenshot for the date i need to set to current date, Right now it is showing date June 10,2013. Please help.
Eyup
Telerik team
 answered on 17 Dec 2018
1 answer
275 views
I was just wondering if you would be able to give me a list of features that can be implemented into the MVC Chat widget. I have worked through the demo but it is not very robust and just has the chat broadcasting to everyone who has it open. Is there a way to implement things such as private chat sessions, linking to data in the app via chat, chat bot in MVC?(I saw there was a chatbot option in Jquery). Just wanting to know if I can use the MVC Chat for more or if I will have to work with the Jquery Chat.
Dimitar
Telerik team
 answered on 14 Dec 2018
1 answer
452 views

How can I pass data from the client to the Read action for a MultiSelect using virtualization. Here is the declaration of the MultiSelect I'm using:

@(Html.Kendo().MultiSelectFor(model => model.SelectedProjectIds)
    .Filter(FilterType.StartsWith)
    .DataTextField("Name")
    .DataValueField("Id")
    .HtmlAttributes(new { style = "width: 100%" })
    .Placeholder("- Select Project(s) -")
    .DataSource(source =>
    {
        source.Custom()
            .ServerFiltering(true)
            .ServerPaging(true)
            .PageSize(80)
            .Type("aspnetmvc-ajax")
            .Transport(transport =>
            {
                transport.Read("ProjectRead", "ProjectPlan");
            })
            .Schema(schema =>
            {
                schema.Data("Data")
                        .Total("Total"); 
                            });
    })
    .Virtual(v => v.ItemHeight(26))
)

I'd like to pass in some data in the Transport Read. Here is the action method for the Read:

        [HttpPost]
        public ActionResult ProjectRead([DataSourceRequest] DataSourceRequest request)
        {
            return Json((GetProjects() as List<NamedEntity>).ToDataSourceResult(request));
        }

So, in addition to the DataSourceRequest object, I'd like to pass in a string from the client-side. How can this be done?

Dimitar
Telerik team
 answered on 14 Dec 2018
3 answers
489 views

Hello,

I can get the multi filter to display or I can get the row filtering but I can't get both at once. My client is an excel experience heavy user and say the grid displays 700 records. They then want the ability to row filter and say that reduces it down to 350. Then they want to apply column value multi select filters to narrow the 350 down even further.

However I have tried a couple different combinations and while they don't error out I don't get both filters on one grid.

One attempt:

@(Html.Kendo().Grid(Model)
        .Name("grid")
        .Columns(columns =>
        {
            columns.Bound(e => e.A).Filterable(ftb => ftb.Multi(true).Search(true));
            columns.Bound(e => e.B).Filterable(ftb => ftb.Multi(true).Search(true));
            columns.Bound(e => e.C).Filterable(ftb => ftb.Multi(true).Search(true));
            columns.Bound(e => e.D).Filterable(ftb => ftb.Multi(true).Search(true));
            columns.Bound(e => e.E).Filterable(ftb => ftb.Multi(true).Search(true));
        })
        .HtmlAttributes(new { style = "width: 80%;" })
        .DataSource(data => data.Ajax().Model(mdl => mdl.Id(p => p.A) ))
        .Scrollable()
        .Groupable()
        .Sortable()
        .Editable()
        .Filterable(ftb => ftb.Mode(GridFilterMode.Row))
        .Resizable(size => size.Columns(true))
        .Selectable(selectable => selectable.Mode(GridSelectionMode.Multiple))
        .Pageable(pageable => pageable
            .Refresh(true)
            .PageSizes(true)
            .ButtonCount(5))
        )

 

Another attempt:

@(Html.Kendo().Grid(Model)
        .Name("grid")
        .Columns(columns =>
        {
            columns.Bound(e => e.A).Filterable(ftb => ftb.Multi(true).Search(true)).Filterable(ftb => ftb.Mode(GridFilterMode.Row));
            columns.Bound(e => e.B).Filterable(ftb => ftb.Multi(true).Search(true));
            columns.Bound(e => e.C).Filterable(ftb => ftb.Multi(true).Search(true));
            columns.Bound(e => e.D).Filterable(ftb => ftb.Multi(true).Search(true));
            columns.Bound(e => e.E).Filterable(ftb => ftb.Multi(true).Search(true));
        })
        .HtmlAttributes(new { style = "width: 80%;" })
        .DataSource(data => data.Ajax().Model(mdl => mdl.Id(p => p.A) ))
        .Scrollable()
        .Groupable()
        .Sortable()
        .Editable()
        .Filterable()
        .Resizable(size => size.Columns(true))
        .Selectable(selectable => selectable.Mode(GridSelectionMode.Multiple))
        .Pageable(pageable => pageable
            .Refresh(true)
            .PageSizes(true)
            .ButtonCount(5))
        )

 

Thoughts?

JB

Alex Hajigeorgieva
Telerik team
 answered on 13 Dec 2018
1 answer
692 views

I am getting this error "The Type or Namespace name ' GridAction' could not be found" while upgrading the application from version 2011.2.712 to 2018.3.1017.

Please let me know how to solve this error.

Tsvetina
Telerik team
 answered on 13 Dec 2018
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?