Telerik Forums
UI for ASP.NET MVC Forum
5 answers
1.1K+ 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
199 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
284 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
874 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
336 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
340 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
1.0K+ 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
394 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
6 answers
687 views

Is there currently a way to use DropDownList that would allow a USER to delete an item?  We are creating a facility of saved searches and we'd love to be able to allow the user to be able to click an 'X' in a dropdown to trigger a delete of the item from the list (and ultimately the database) as seen in the attached screen shot.

 

 

Dimitar
Telerik team
 answered on 31 Aug 2018
1 answer
186 views

We are using Telerik Rad-editor (Version: 2017.2.503.40) in our application. The Rad-editor control which we use looks like the sample you provided in "Save in database" link.
We are facing 1 issue while uploading image through Image Manager control. If we upload an image then we face 1 console error. Below is the description for the error.
ScriptResource.axd?d=WumqVucm-BTOpradDSIl6FwWq2Nf8yJ7sqq9-igzn7fhpcm7LMUuXAF__xzJt_PP7G8atwaBX_21lH9wtho_Q-JsnyL97IPmZiErbgIsKQvtmeYlHiL_GqtD3HsMVT9KS6u1-fBfjgRuY07t3m9OjNcjVdzCqYRpX7UHxymyD6WPAuy90&t=ffffffffad4b7194:5 Uncaught Error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500
Can you please provide us the solution/your suggestions please?

Thanks in advance.

Rumen
Telerik team
 answered on 31 Aug 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
DropDownButton
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
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
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?