Telerik Forums
UI for ASP.NET MVC Forum
6 answers
485 views

I see that when doing a copy a Create call is executed and when doing a move it executes Create and Destroy. Is there a way to detect when a copy was done vs a move?  When doing a move, I actually need to do a move in the back end so a Create and Destroy does not work for me.

 

Thanks,

Martin
Telerik team
 answered on 27 Jul 2020
1 answer
429 views

I'm having trouble saving the value that's selected in the drop down list on a grid.  It's as though the model doesn't update.  The drop down list comes up when I click the edit button.  The drop down is populated, but when I hit update and the code makes it to UpdateAdHocOrderDetails, but both the MailingListId and MailingListName are what they were before the update.  What have I missed wiring up or what did I wire up incorrectly?

Code in my view....

<div class="content">
@(Html.Kendo()
.Grid<IndexViewModel>()
.Name("kendoGrid")
.Columns(columns =>
{
columns.Bound(c => c.OrderDetail.Isbn).Title("ISBN").Width(135);
columns.Bound(c => c.OrderDetail.Title).Width(300);
columns.Bound(c => c.OrderDetail.Author).Width(125);
columns.Bound(c => c.OrderDetail.CartonQuantity).Title("Carton QTY").Width(140);
columns.Bound(c => c.OrderDetail.OrderedQuantity).Title("QTY").Width(90);
columns.Bound(c => c.OrderDetail.MailingListName).Title("Mailing List").ClientTemplate("#=OrderDetail.MailingListName#").Width(90);
columns.Bound(c => c.OrderDetail.OnHand).Title("On Hand QTY").Width(90);
columns.Bound(c => c.OrderDetail.AMROM).Title("ROM").Width(140);
columns.Bound(c => c.OrderDetail.SuggestedQuantity).Title("Recommended Order QTY").Width(140);
columns.Command(command => { command.Edit(); command.Destroy(); }).Width(150);
})
.ToolBar(toolbar => toolbar.Custom().Text("Clear All Filters").Url("#").HtmlAttributes(new { onclick = "ClearAllFilters('kendoGrid')", @class = "k-primary" }))
.Scrollable()
.Sortable()
.Filterable()
.Editable(editable => editable.Mode(GridEditMode.InLine).ConfirmDelete("test").DisplayDeleteConfirmation(true))
.Pageable(pageable => pageable
.Refresh(true)
.ButtonCount(5))
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(12)
.Model(model => {
model.Id(p => p.OrderDetail.OrderDetailId);
model.Field(p => p.OrderDetail.OrderDetailId).Editable(false);
model.Field(p => p.OrderDetail.Isbn).Editable(false);
model.Field(p => p.OrderDetail.Title).Editable(false);
model.Field(p => p.OrderDetail.Author).Editable(false);
model.Field(p => p.OrderDetail.CartonQuantity).Editable(false);
model.Field(p => p.OrderDetail.OrderedQuantity).Editable(true);
model.Field(p => p.OrderDetail.MailingListName).Editable(true);
model.Field(p => p.OrderDetail.OnHand).Editable(false);
model.Field(p => p.OrderDetail.AMROM).Editable(false);
model.Field(p => p.OrderDetail.SuggestedQuantity).Editable(false);
})
.Sort(sort => sort.Add(order => order.OrderDetail.OrderDetailId).Descending())
.Read(read => read.Action("GetAdHocOrderDetails", "Adhoc").Data("gridInfo"))
.Update(update => update.Action("UpdateAdHocOrderDetails", "Adhoc").Data("gridInfo"))
.Destroy(update => update.Action("RemoveAdHocOrderDetails", "Adhoc").Data("gridInfo"))
.Events(events => {
events.Change("OnGridChange");
events.Error("error_handler");
})
.ServerOperation(false))
.Events(events => events.DataBound("onDataBound"))
.Resizable(resize => resize.Columns(true))
)
</div>

Code in Views\Shared\EditorTemplates\MailingListEditor.cshtml.....

@(
Html.Kendo().DropDownListFor(model => model.OrderDetail.MailingListName)
.Name("MailingListName")
.DataTextField("MailingListName")
.DataValueField("MailingListId")
.OptionLabel("Select a mailing list...")
.DataSource(source =>
{
source.Read(read => { read.Action("GetMailingLists", "Adhoc"); });
}))
)

Code in the model....

        [UIHint("MailingListEditor")]
        public string MailingListName { get; set; }
        public int MailingListId { get; set; }

Code in the controller....

        [AcceptVerbs(HttpVerbs.Post)]
        [AuthorizeUser(AccessLevel = "Publisher")]
        public ActionResult UpdateAdHocOrderDetails([DataSourceRequest] DataSourceRequest request, IndexViewModel lineItem, int orderId)
        {

        }

Anton Mironov
Telerik team
 answered on 23 Jul 2020
1 answer
2.1K+ views

Hello - 
Can you please explain why the drop-down's or other controls are not loading in Kendo Window if we set the Deferred(). 

If i remove the Deferred() its working and loading the window properly.

Any help or pointers ?

@(Html.Kendo().DropDownList()
        .Name("categories")
        .HtmlAttributes(new { style = "width:100%" })
        .OptionLabel("Select a category...")
        .DataTextField("Text")
        .DataValueField("Value")
        .BindTo(new List<SelectListItem>() {
            new SelectListItem() {
                Text = "Black",
                Value = "1"
            },
            new SelectListItem() {
                Text = "Orange",
                Value = "2"
            },
            new SelectListItem() {
                Text = "Grey",
                Value = "3"
            }
        }).Deferred()
        .Events(e => e.Change("onCategoryChange"))
    )

Aleksandar
Telerik team
 answered on 22 Jul 2020
1 answer
227 views

Hi,

We have a requirement, where-in we have lookups and these lookups can in turn have lookups. So, we have one kendo window opened from the main page -> from this kendo window, open another kendo window popup --> and another, and so on. 

Please advise how we can achieve this functionality, since we are unable to successfully achieve this having tried many options.

Thanks,

Faraaz

 

Petar
Telerik team
 answered on 22 Jul 2020
5 answers
246 views

I'm having an issue with my chart not properly mapping fields I believe it very well could be how I've configured it.

According to the exception PickDistributionModel.UserName is not defined, however upon inspection of the endpoint returning the List<PickDistributionModel> it is populated with the users login.

 

Exception being thrown:

Uncaught ReferenceError: UserName is not defined<br>    at eval (eval at compile (kendo.all.min.js:25), <anonymous>:3:84)<br>    at init._pointContent (kendo.all.min.js:128)<br>    at init.show (kendo.all.min.js:128)<br>    at init._showTooltip (kendo.all.min.js:127)<br>    at r.callObserver (kendo.all.min.js:118)<br>    at r.trigger (kendo.all.min.js:118)<br>    at init.trigger (kendo.all.min.js:127)<br>    at init.notify (kendo.all.min.js:118)<br>    at r.show (kendo.all.min.js:124)<br>    at r.show (kendo.all.min.js:126)

 

Chart Implementation:

@(Html.Kendo().Chart<PickDistributionModel>().Name("picker-workload").Title(title =><br>{<br>title.Text("Pick Distribution (24hr)");<br>title.Position(ChartTitlePosition.Top);<br>}).Legend(legend => legend.Visible(false))<br>.ChartArea(chart => chart.Background("transparent"))<br>.DataSource(source => source.Read(read => read.Action("GetPickDistributions", "BoeingOrder", new{Area=""})))<br>.Series(s => s.Pie(m => m.Total, m => m.UserName)<br>.Tooltip(tooltip => tooltip.Visible(true).Template("#= UserName #: \n 0: #= Open # \n A: #= Audit # \n P: #= Picked #")).StartAngle(150)))

 

Controller Endpoint:

        /// <summary><br>        /// Gets the distribution of picks for users within the last 24 hours.<br>        /// </summary><br>        /// <returns><br>        /// An array of <see cref="PickDistributionModel"/><br>        /// </returns><br>        [HttpPost]<br>        public async Task<ActionResult> GetPickDistributions()<br>        {<br>            try<br>            {<br>                var floor = DateTime.Now.AddDays(-75).Date;<br>                var ceiling = DateTime.Now.AddDays(-74).Date;<br>                using var service = new PickAssignmentService();<br>                var _ = await service.GetPickDistributionsAsync(floor: floor, ceiling: ceiling).ConfigureAwait(false);<br>                return this.Json(_);<br>            }<br>            catch (Exception e)<br>            {<br>                // TODO: Document Exception<br>                var errorId = this.LogError(e, GetUserId(), nameof(BoeingOrderController));<br>                e.ToLog(errorId);<br>            }<br><br>            return BadRequest("Woops, something went wrong.");<br>        }

 

Chart Model:

    /// <summary><br>    /// The model for representing pick distribution in a(n) chart.<br>    /// </summary><br>    public class PickDistributionModel<br>    {<br>        /// <summary><br>        /// The name of the [dbo].[SecurityUser] the pick distribution model represents.<br>        /// </summary><br>        public string UserName { get; set; }<br><br>        /// <summary><br>        /// The total number of picks in a(n) users distribution.<br>        /// </summary><br>        public string Total { get; set; }<br><br>        /// <summary><br>        /// The number of picks in a(n) "picked" status.<br>        /// </summary><br>        public string Picked { get; set; }<br><br>        /// <summary><br>        /// The number of picks in a(n) "non-picked" status.<br>        /// </summary><br>        public string Open { get; set; }<br><br>        /// <summary><br>        /// The number of picks in a(n) "audit" status.<br>        /// </summary><br>        public string Audit { get; set; }<br>    }
Silviya Stoyanova
Telerik team
 answered on 21 Jul 2020
3 answers
1.7K+ views

I'm trying to create a Kendo Window that will present the user with a Kendo DropDownList and then cascade that selection to a Kendo ListView. I'm confused by when and where I need to use ToHtmlString() and Render(). I also want to handle the DropDownList and ListView events.

Main razor page (sorry, couldn't get code formatter to make this look better):

@(Html.Kendo().Window()
    .Name("myModal")
    .Title("Select Answer")
    .Content(Html.Partial("_MyPartial").ToHtmlString())
    .Draggable()
    .Resizable()
    .Width(600)
    .Visible(false)
    .Actions(actions => actions.Pin().Minimize().Maximize().Close())
)  // I've tried with and without .Render() here

Javascript to call window:

 $("#myModal").data("kendoWindow").open();  // works fine

Then _MyPartial:

<div>
    <h5>Categories:</h5>
    @(Html.Kendo().DropDownList()
          .Name("categories")
          .HtmlAttributes(new { style = "width:100%" })
          .OptionLabel("Select a category...")
          .DataTextField("Text")
          .DataValueField("Value")
          .DataSource(source =>
          {
              source.Read(read =>
              {
                  read.Action("GetCategories", "Home");
              });
          })
          .Events(e => e.Change("onCategoryChange"))
          .ToHtmlString()  // Without this, it doesn't recognize onCategoryChange, with it html is displayed in window
    )
    
    <h5>Click to select a question</h5>
    @(Html.Kendo().ListView<MyViewModel>()
          .Name("questions")
          .TagName("div")
          .ClientTemplateId("questionTemplate")
          .DataSource(dataSource =>
          {
              dataSource.Read(read =>
              {
                  read.Action("GetQuestions", "Home").Data("filterQuestions");
              }).ServerOperation(true);
          })
          .Pageable()
          .Selectable(selectable => selectable.Mode(ListViewSelectionMode.Single))
          .Events(events => events.Change("onQuestionChange"))
          .AutoBind(false)
          .ToHtmlString()
    )
</div>

Javascript to handle events on this partial page. I have tried placing this code on the partial and on the main razor page.

function filterQuestions() {
        return {
            questionId: $("#categories").data("kendoDropDownList").dataItem().Value
    };

function onCategoryChange() {
       $("#questions").data("kendoListView").dataSource.read();
    };

function onQuestionChange() {

        var selected = $.map(this.select(), function (item) {
            return $(item).text();
        });
        $("#Question").val(selected);
        $("#questionBankModal").data("kendoWindow").close();
        $("#btnQuestion").show();
    };

 

 

Veselin Tsvetanov
Telerik team
 answered on 21 Jul 2020
3 answers
138 views

I am setting up an editible grid and want to use the datasource version of the ForeinKey column.

columns.ForeignKey(d => d.AbbreviationId, ds => ds.Read(r => r.Action("GetAbbreviations", "API/Enum")), "Id", "Description").Width(100);

 

The dropdown list in the grid is filled properly etc., but the dropdown itself is not AutoWidth(true). To make this happen, I edited the GridForeignKey editor template. This does however not effect the dropdown.

When tested with a foreign key column that is filled via the ViewData[], this has the desired effect.

Tsvetomir
Telerik team
 answered on 21 Jul 2020
3 answers
579 views

Hi,

I've Kendo Grid UI for MVC in my current MVC.NET project and there is a dropdownlist at the bottom of the grid, which, I believe is supposed to display page numbers, but currently this dropdownlist is getting only value "1" regardless of how many page I have.

 

I have attached a screen shot of the page for further clarification, 

 

I want to fix this by binding the correct number of pages I am displaying and refresh the grid upon dropdownlist selection is changed.

 

Looking for assistance asap

 

Thank you

Medhanie
Top achievements
Rank 1
Veteran
 answered on 20 Jul 2020
4 answers
1.0K+ views

Below the snippet i was trying.

columns.Bound(c => c.OrderNumber).Title("OrderNumber").                                   

                                        .EditorTemplateName("_EditTextBox").EditorViewData(new { maxLength = 3})

Any help or pointers ?

Suresh
Top achievements
Rank 1
Veteran
 answered on 20 Jul 2020
2 answers
6.2K+ views

it's not work,how to use EditorTemplateName?

columns.Bound(u => u.RoleNameString).EditorTemplateName(
"roles_editor"

);



<script type="text/javascript">

function roles_editor()

 

{

}

</script>

 

 

Anton Mironov
Telerik team
 answered on 17 Jul 2020
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
Upload
ComboBox
MultiSelect
Window
ListView
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
Rating
ScrollView
ButtonGroup
CheckBoxGroup
Licensing
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
AICodingAssistant
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
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
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
Iron
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?