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

Hello. I am trying to implement a dropdownlist and I need some help. I have 2 simple tables (Employee and Department). Each employee belongs to a department and a department can have multiple employees. I am using EF database first approach. EF generated the 2 classes (Employee.cs and Department.cs) and each class has a reference to the other.

This is my controller actionmethod

public ActionResult Kendo()
        {
            db.Configuration.LazyLoadingEnabled = false;
            var departments = db.Departments.ToList();
            ViewData["departments"] = departments;

            var employees = db.Employees.Include(e => e.Department).ToList();
            return View(employees);
        }

The view is

@(Html.Kendo().Grid(Model)
        .Name("Grid")
        .Columns(c =>
        {
            c.Bound(e => e.EmployeeId);
            c.Bound(e => e.FirstName);
            c.Bound(e => e.LastName);
            c.Bound(e => e.Gender);
            c.Bound(e => e.City);
            c.Bound(e => e.Department.DepartmentName);
            //columns.ForeignKey(e => e.DepartmentId, Model.Select(e => e.Department), "DepartmentId", "DepartmentName");
            //columns.Bound(e => e.Department.DepartmentName).EditorTemplateName("DepartmentEditor").Title("Department").Width(250);
            //columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200);
        })
        //.DataSource(d => d
        //    .Ajax()
        //    .ServerOperation(false)
        //)
        .Pageable() //Enable the paging.
        .Sortable() //Enable the sorting.
        .Filterable()
        .Scrollable()
)

The EditorTemplate

@(Html.Kendo().DropDownList()
          .Name("Department")
          .DataValueField("DepartmentId")
          .DataTextField("DepartmentName")
          .BindTo((IEnumerable)ViewData["departments"])
)

 

Issues I am having:

  • I am getting a circular reference if I uncomment the datasource line in the view.
  • I need to have CRUD operations and I need to show the department as a dropdownlist on Edit/Add. On Edit, the dropdownlist needs to select the current department of the employee. 

Thanks.

Georgi
Telerik team
 answered on 20 Dec 2018
2 answers
764 views

Hi,

I have a grid that has one dynamically sized column to maximize space (it contains the most data).  As the browser window is resized to be smaller and that column shrinks, it eventually disappears.  All of the other columns are auto-sized to contents.

Is there a way to set a minimum width for the column so that when I resize the browser window, it will freeze the width of that column when it reaches a certain threshold and scroll instead?

(I am using the MVC suite of controls.)

Thanks!
Brian

Brian
Top achievements
Rank 2
Iron
 answered on 19 Dec 2018
2 answers
245 views

Hello,

I am trying the Kendo Slider for ASP MVC and want to set the inital values programatically. To do this I have this line of code:

 @Html.Kendo.RangeSlider.Name("rangesliderStadtverkehr").Min(0.6).Max(5.5).SmallStep(0.1).LargeStep(1).Values(CDbl(0.6), CDbl(5.5))

 

But when the site is rendered the selectionStart-value is set to 6 and the selectionEnd-value is set to 55. It seems that the decimal-point ist forgotten.

An additional problem is a linebreak at the end of the renderd slider. For both problems I have added an attachment.

Can you help me to fix the problems? Thank you.

Best regards, Martin

Tsvetomir
Telerik team
 answered on 19 Dec 2018
4 answers
346 views

Hi Guys

Long time user of your products..I am considering re subscribing to get access to the new chat component. So far my tests using the Trial license is going pretty well

One issue I have hit is that in my solution, the user needs to reload the chat window ( placing on hold and returning to it). I need to reload the historic conversation , which is all good.. apart from the time stamps ( the ones that are shown when you select the text). This is always set to the time I recreate the chat, but I want to use the actual date and time stamp that message was given. ( the original timestamp)
Is there anyway I can set the timestamp to be displayed when using the RenderMessage method?. ( I see none, but I know how clever you guys are!) 

Many thanks

Rob

 

Rob
Top achievements
Rank 2
Iron
Veteran
Iron
 answered on 19 Dec 2018
10 answers
1.7K+ 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
361 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
840 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
431 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
709 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
257 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
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
ComboBox
Upload
MultiSelect
ListView
Window
TabStrip
Menu
Installer and VS Extensions
Spreadsheet
AutoComplete
TreeList
Gantt
PanelBar
NumericTextBox
Filter
ToolTip
Map
Diagram
Button
PivotGrid
Form
ListBox
Splitter
Application
FileManager
Sortable
Calendar
View
MaskedTextBox
PDFViewer
TextBox
Toolbar
Dialog
MultiColumnComboBox
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
Security
ColorPicker
DateRangePicker
Wizard
Styling
Chat
DateInput
MediaPlayer
TileLayout
Drawer
SplitView
Template
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Licensing
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
Localization
MultiViewCalendar
PopOver (Mobile)
Ripple
ScrollView (Mobile)
Switch (Mobile)
PivotGridV2
FlatColorPicker
ColorPalette
DropDownButton
AIPrompt
PropertyGrid
ActionSheet (Mobile)
BulletGraph
Button (Mobile)
Collapsible
Loader
CircularGauge
SkeletonContainer
Popover
HeatMap
Avatar
ColorGradient
CircularProgressBar
SplitButton
StackLayout
TimeDurationPicker
Chip
ChipList
DockManager
ToggleButton
Sankey
OTPInput
ChartWizard
SpeechToTextButton
InlineAIPrompt
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
AICodingAssistant
SmartPasteButton
PromptBox
SegmentedControl
LLM Kit
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?