Telerik Forums
UI for ASP.NET MVC Forum
1 answer
110 views
Hi, Is there any possibility to export to PDF for gantt timeline view and contents view separately? Reply asap.
Nencho
Telerik team
 answered on 07 Sep 2018
2 answers
183 views

HI, I work on a project that uses Kendo MVC widget. I install it from the Telerik Nuget Source and add: Telerik.UI.for.AspNet.Mcv5 Version 2018.2.704. All work great until I need to use ForeignKey column in my grid. The drop-down list does not appear. I look on Google and someone says that I need to add the EditroTemplates views under Views/Shared in my MVC project. So I took the one in your demo at this location C:\Program Files (x86)\Progress\Telerik UI for ASP.NET MVC R2 2018\wrappers\aspnetmvc\Examples\VS2017\Kendo.Mvc.Examples\Views\Shared

But Now I got this runtime error: cannot load  'System.Web.Mvc.ViewUserControl<object>'. in

Line 1 : <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<object>" %>
Line 2 :
Line 3 : <%= Html.Kendo().TextBoxFor(model => model)%>

Source file : /Views/Shared/EditorTemplates/String.ascx    Line : 1 

What do I missed?

Pierre
Top achievements
Rank 2
Iron
Iron
 answered on 06 Sep 2018
5 answers
1.0K+ views

Hi

I'm trying to setup TabStrip and its only show the first tab which i set .Selected(true) to , here is my code :

<div class="demo-section k-content">
    @(Html.Kendo().TabStrip()
    .Name("tabstripname")
    .Items(tabstrip =>
    {
        tabstrip.Add().Text("Bank Account")
                    .Selected(true)
                     .LoadContentFrom("Bank", "People", new { personid = ViewData["personid"] });
 
        tabstrip.Add().Text("Address")
                     .LoadContentFrom("Address", "People", new { personid = ViewData["personid"] });
 
        tabstrip.Add().Text("ContactNumber")
                     .LoadContentFrom("ContactNumber", "People", new { personid = ViewData["personid"] });
 
        tabstrip.Add().Text("Email Address")
                     .LoadContentFrom("Email", "People", new { personid = ViewData["personid"] });
    })
    )
</div>

 

example of controller code :

public PartialViewResult Commercial()
{
      return PartialView();
}
Ivan Danchev
Telerik team
 answered on 06 Sep 2018
1 answer
132 views
I have a grid used for batch editing.  There are only two editable fields in the grid(ImageStatus and Description).  When changing the radio button in a specific cell I am opening a window to gather additional data for the row that is in the model but not in the grid.  
FollowUp, Comment and FollowUpDate are in the model but not in the grid.
When closing the window I want to update the model data for the row so that when I save the grid, the additional data saves with it.
How do I get the data collected in the window back to the model data for the row so it will update when I save the grid?
Alex Hajigeorgieva
Telerik team
 answered on 06 Sep 2018
1 answer
227 views

Good afternoon Admin,

How to set the hyperlink color for .AllDayEventTemplate and .EventTemplate in scheduler?  When I added the style to the page, some hyperlinks color inside the scheduler still do not change.

Here is the code:

<style>
    a:link { color: #0000ff; }
    a:hover { text-decoration: underline; }
    .k-event k-event-inverse, .k-event 
        a:link { color: #0000ff; }
        a:hover {text-decoration: underline}       
</style>

@(Html.Kendo().Scheduler<HomeTaskViewModel>()
        .Name("scheduler")
        .Date(DateTime.Today)      
        .Editable(false)
        .Height(800)
        .AllDayEventTemplate("<a href='" + @Url.Action("Read", "Request") + "/" + "#= RequestId #'>#= description #</a>")    
        .EventTemplate("<a href='" + @Url.Action("Read", "Request") + "/" + "#= RequestId #'>#= description #</a>")     
        .Views(views =>
        {
            views.DayView();
            views.WorkWeekView(workWeekView => workWeekView.Selected(true));
            views.WorkWeekView();
            views.WeekView();
            views.MonthView();
            views.AgendaView();
    })
    .Resources(resource =>
    {
        resource.Add(m => m.GroupId)
            .Title("Owner")
            .DataTextField("Text")
            .DataValueField("Value")
            .DataColorField("Color")
            .BindTo(Model.Select(x => new { Text = x.GroupName, Value = x.GroupId, Color = x.Color }));
    })
    .DataSource(d => d
    .Model(m =>
    {
        m.Id(f => f.RequestId);
        m.Field(f => f.Description).DefaultValue("No title");
        m.Field(f => f.GroupId).DefaultValue(1);
        m.Field(f => f.Title).DefaultValue("No title");
        m.RecurrenceId(f => f.RecurrenceID);
    })
    .Read("ReadRequests", "Home", "Scheduler")
    )
    )

<script type="text/javascript">
    $(function () {
        $(".GroupNames :checkbox").change(function (e) {
            var checked = $.map($(".GroupNames :checked"), function (checkbox) {
                return parseInt($(checkbox).val());
            });

            var filter = {
                logic: "or",
                filters: $.map(checked, function (value) {
                    return {
                        operator: "eq",
                        field: "GroupId",
                        value: value
                    };
                })
            };

            var scheduler = $("#scheduler").data("kendoScheduler");
            scheduler.dataSource.filter(filter);
        });
    })
</script>

 

What is the correct way to do it?

Thanks in advance for your help!

Anieda

 

Anieda Hom
Top achievements
Rank 1
 answered on 05 Sep 2018
1 answer
827 views

     I'm trying to set values to the empty model when i click add and show the custom edit template, i've set them through javascript but it doesn't show on popup window.

 

function onEdit(e) {
            var today = new Date();
            e.model.FECHA = today;
            console.log(e.model)
        }

 

Also i've set them in the model constructor but it doesn't work, the only way to set it is via javascript and delaying the script a few seconds but this solution it's not reliable

 

thank you

 

 

Georgi
Telerik team
 answered on 05 Sep 2018
1 answer
281 views

Hi dear Telerik team.
I'm trying to use grid for showing and editing grid in UTC format.

@(Html.Kendo().Grid<TelerikGridTestApp.Models.ClientViewModel>()
          .Name("Grid")
          .Columns(columns =>
          {
              columns.Bound(p => p.ClientName).Title("Name");
              columns.Bound(p => p.ClientBirthday).Format("{d:0}").Title("Start Date").HtmlAttributes(new Dictionary<string, object> { { "class", "utc-date" } });
              columns.Command(command =>
              {
                  command.Edit();
              });
          })
          .ToolBar(toolbar => toolbar.Create())
          .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("ClientEditor"))
          .Pageable(pager => pager.PageSizes(new[] { 10, 20, 30, 50 }))
          .Events(e => e.DataBound("onDataBound").Edit("onEdit"))
          .HtmlAttributes(new { style = "height: 550px;" })
          .Sortable()
          .Scrollable()
          .Resizable(configurator => configurator.Columns(true))
          .Filterable()
          .DataSource(dataSource => dataSource
              .Ajax()
              .Model(model => model.Id(p => p.ClientID))             
              .Create(create => create.Action("Client_Create", "Grid"))
              .Read(read => read.Action("Clients_Read", "Grid"))
              .Update(update => update.Action("Client_Update", "Grid"))
              .Sort(configurator => configurator.Add(c => c.ClientName))
          )
)


I understand that when data comes to browser, it converts to local date time of the browser. So I have to convert it back to UTC date time, and paste to the CELL of the grid.

function onDataBound() {
        $(".utc-date").each(function () {
            var text = LocalToUtc($(this).text());
            $(this).text(text);
        });       
    }

Also I do the same for popup dialog

@model TelerikGridTestApp.Models.ClientViewModel
 
@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
 
<fieldset>
    <legend>Client</legend>
    @Html.HiddenFor(model => model.ClientID)
    <div class="editor-label">
        @Html.LabelFor(model => model.ClientName, "Client Name")
        @Html.ValidationMessageFor(model => model.ClientName)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.ClientName)
    </div>
    <div class="editor-label">
        @Html.LabelFor(model => model.ClientBirthday, "Client Birthday")
    </div>
    <div class="editor-field">
        @Html.Kendo().DatePickerFor(model => model.ClientBirthday).HtmlAttributes(new { @class = "kendo-utc-date" })
        @Html.ValidationMessageFor(model => model.ClientBirthday)
    </div>
    @Html.HiddenFor(model => model.TimeZoneOffsetMinutes)
</fieldset>
}
 
@section Scripts {
    @Scripts.Render("~/bundles/jqueryval");
}

- I change dates using "onEdit" event.

function onEdit(e) {
       if (e.model.isNew())
           return;       
       var datePicker = $($("input.kendo-utc-date")).data("kendoDatePicker");
       var utcDate = datePicker .value();
       datePicker .value(toLocal(utcDate));
       var timeZoneOffsetControl = $("#TimeZoneOffsetMinutes");
       timeZoneOffsetControl.val(new Date().getTimezoneOffset())
       timeZoneOffsetControl.change();
   }

But when I press "Cancel" button or just close the dialog, the date converts back to local date in the grid. When I press "Update" button, it looks like any mechanism takes the updated date, converts it to UTC (according to my conversion) and shows on front end, but on back end I have correct date.
I figured out that the grid has a storage, and when I update the record, the grid updates the record in the storage and sends the updated record to the back end is separately. It makes sense if I update regular string or number. But What should I do in my case?

Viktor Tachev
Telerik team
 answered on 04 Sep 2018
3 answers
298 views

Hi,

I've just upgraded to the version 2018.2.620. I noticed that window.title no longer displays special characters correctly. For example:

In previous version, setting the title to finnish: "Viesti Phoenixist&#228;" rendered correctly "Viesti Phoenixistä". Now the translation of &#228 character does not work anymore.

Are there any solutions to this?

Thanks and regards,
Viktor

Benedikt
Top achievements
Rank 1
 answered on 03 Sep 2018
3 answers
987 views

I have a popup editor configured on a grid.  In the editor template, I have a dropdownfor with a Read action.  I need to pass the model value to the read action but it is not recognized.  Can you help?

Here is the editor template:

@model Procurement.Models.Pipe
<style>
    .k-edit-form-container {
        width: auto;
    }
</style>
<div class="panel" style="padding:5px;">
  
  
    @Html.HiddenFor(m => m.MaterialId)
    @Html.HiddenFor(m => m.PcsPartNum)
    @Html.HiddenFor(m => m.OuterDiameter, new { id="OD", name="OD"})
    <table>
        <tr><td colspan="2" align="center"><h4 class="text-info"> Pipe Details</h4></td></tr>
        <tr><td colspan="2" align="center"> <hr /></td></tr>
        <tr>
            <td width="30%">PCS Part Num</td>
            <td>@Html.TextBoxFor(m => m.PcsPartNum, new { ReadOnly = "true" })</td>
        </tr>
        <tr>
            <td>Description</td>
            <td>@Html.TextAreaFor(m => m.Description, new { ReadOnly = "true", TextMode = "MultiLine", Rows = "3", Cols = "500" })</td>
        </tr>
        <tr>
            <td>Sort Order</td>
            <td>@Html.TextBoxFor(m => m.Materials_Group.SortOrder, new { ReadOnly = "true" })</td>
        </tr>
        <tr>
            <td>Unit</td>
            <td>@Html.TextBoxFor(m => m.Materials_Group.Unit, new { ReadOnly = "true" })</td>
        </tr>
        <tr><td colspan="2"><hr /></td></tr>
        <tr>
            <td colspan="2" align="center">
                <table>
                    <tr>
                        <td class="text-info" width="30%">Client Part Num</td>
                        <td colspan="2">@Html.EditorFor(m => m.ClientPartNum)</td>
                    </tr>
                    <tr>
                        <td class="text-info">Additional Info</td>
                        <td colspan="2">@Html.TextAreaFor(m => m.AdditionalInfo, new { TextMode = "MultiLine", Rows = "3", Cols = "500" })</td>
                    </tr>
                    <tr><td colspan="2" align="center"><h5 class="text-info">Properties</h5></td></tr>
                    <tr>
                        <td class="text-info">Outer Diameter</td>
                        <td>@Html.DisplayFor(m=>m.OuterDiameter, new { style="width:100px;id:tbOD"})</td>
                        <td>@(Html.Kendo().DropDownListFor(m => m.OuterDiameter)
                            .Name("OuterDiameter")
                            .DataValueField("Text")
                            .DataTextField("Value")
                            .DataSource(ds =>
                            {
                                ds.Read(read =>
                                {
                                    read.Action("GetPipeOD", "Materials", new { od = m.OuterDiameter }); <<<<<< Here is where the model value needs to be sent >>>>>>>
                                });
                            })
                            .HtmlAttributes(new { style="width:100px"})
                            //.Events(e =>
                            //{
                            //    e.Change("onChange").Select("onSelect");
                            //})
                            )
                       </td>
                    </tr>
                    <tr>
                        <td class="text-info">Wall Thickness</td>
                        <td colspan="2"></td>
                    </tr>
                    <tr>
                        <td class="text-info">Specification</td>
                        <td></td>
                    </tr>
                    <tr>
                        <td class="text-info">Grade</td>
                        <td colspan="2"></td>
                    </tr>
                    <tr>
                        <td class="text-info">Seam Type</td>
                        <td colspan="2"></td>
                    </tr>
                    <tr>
                        <td class="text-info">Coating 1</td>
                        <td colspan="2"></td>
                    </tr>
                    <tr>
                        <td class="text-info">Coating 2</td>
                        <td colspan="2"></td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</div>

Dimitar
Telerik team
 answered on 03 Sep 2018
2 answers
324 views

Hi,

in my MVC-App I use <authentication mode="Windows" /> and <identity impersonate="true"/> inside web.config which means the current WindowsIdentity is delivered through IIS to SQL-Server. Normally I use the async/await pattern in my code and thus use ToDataSourceResultAsync(...) to get my filtered/sorted/paged results async. When doing so I run into an error. The call from App -> IIS -> SQL-Server is now under the normal "IIS APPPOOL\DefaultAppPool" account which is not a valid SQL-Server user and so the connection is refused. When using the normal ToDataSourceResult(...) call everything works perfect.

The reason for this is the usage of "Task.Factory.StartNew(...)" inside QueryableExtensions.cs. Whenever you use "Task.Factory.StartNew(...)" the impersonation is reset to the default value and is NOT using the identity used inside the MVC-App. Here is a little example (just place the code inside a normal Controller Action):

1.Debug.WriteLine("App is running as: {0}", WindowsIdentity.GetCurrent().Name);
2.await Task.Factory.StartNew(
3.    () =>
4.    Debug.WriteLine("New Task is running as: {0}", WindowsIdentity.GetCurrent().Name),
5.    CancellationToken.None,
6.    TaskCreationOptions.None,
7.    TaskScheduler.Default);

 

As a result you get:
Line 1: "App is running as: myDomain\myUser"
Line 4: "New Task is running as: IIS APPPOOL\DefaultAppPool"

At least you should warn in your documentation that this could happen or think about a better solution for implementing "ToDataSourceResultAsync(...)". In my opinion my scenario is not so seldom in the enterprise world so giving a warning should be a good idea.

Regards
Heiko

 

 

Heiko
Top achievements
Rank 1
Iron
Veteran
 answered on 31 Aug 2018
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
Upload
ComboBox
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
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
ListView (Mobile)
Pager
Accessibility
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
MediaPlayer
TileLayout
DateInput
Drawer
SplitView
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Template
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
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?