Telerik Forums
UI for ASP.NET MVC Forum
3 answers
128 views

Hello,

I have a view with a treelist in batch / cell editing. When I use the update method to post my treelist I also send additional datas.

But if I have no modifications on my treelist, I can't post modifications on additional datas.

Is there a way to enable the update post even if there is no modifications on treelist ? 

This is my view:

@Html.HiddenFor(x => x.Id)
  @(Html.HiddenFor(m => m.UserCreation, new { Value = User.Identity.Name.Split('\\')[1] }))
  <div class="synchroDiv">
      <div>
          @Html.LabelFor(m => m.Nom)
          @(Html.Kendo().TextBoxFor(m => m.Nom))
      </div>
      @Html.ValidationMessageFor(x => x.Nom)
  </div>
 
  <div class="synchroDiv">
      <div>
          @Html.LabelFor(m => m.PctMargeDefaut)
          @(Html.Kendo().NumericTextBoxFor(m => m.PctMargeDefaut)
                .Culture("fr-FR")
                .Min(0)
                .Max(15)
                .Step(0.5))
      </div>
      @Html.ValidationMessageFor(x => x.PctMargeDefaut)
  </div>
 
  <div class="synchroDiv">
      <div>
          <input checked="@Model.EnableCategories" style="width: 0;" type="checkbox" class="switch switch-lg" id="chkCategories" onchange="changeCategoriesVisibility();">
          <label for="chkCategories">Personnaliser les marges des catégories Web</label>
      </div>
  </div>
 
  <div id="categories">
      @(Html.Kendo().TreeList(Model.Categories)
            .Name("profilMargeTreelist")
            .Toolbar(toolbar =>
            {
                toolbar.Save().Text("Enregistrer");
                toolbar.Cancel().Text("Annuler");
            })
            .HtmlAttributes(new { style = "height:100%" })
            .Columns(columns =>
            {
                columns.Add().Field(e => e.Libelle);
                columns.Add().Field(e => e.Code);
                columns.Add().Field(e => e.PctMarge).Template("# if ( PctMarge === null ) {# #=''# #} else {# #= PctMarge # %#} #");
            })
            .Editable(e => e.Mode(TreeListEditMode.InCell).Move(false))
            .DataSource(dataSource => dataSource
                .Batch(true)
                .Update(update => update.Action("UpdateMargeProfil", "ProfilMarge").Data("addData"))
                .Model(m =>
                {
                    m.Id(f => f.Code);
                    m.ParentId(f => f.CodeParent).Editable(false);
                    m.Field(f => f.Code).Editable(false);
                    m.Field(f => f.Libelle).Editable(false);
                    m.Field(f => f.PctMarge);
                    m.Expanded(false);
                })
            ).Height(800))
  </div>

 

Thank you in advance, I hope everything is clear.

Julien

Viktor Tachev
Telerik team
 answered on 01 Oct 2018
3 answers
490 views

My editor seems to be ignoring the minimum on height.

<div class="col-6">
<label>Notes:</label>
@(Html.Kendo().Editor()
.Name("RMIComment")
.HtmlAttributes(new { style = "height:80px" })
.Resizable(resizable => resizable.Content(true).Min(80))
.Tools(tools => tools.Clear())
)
</div>
<br />

 

It appears to always draw on the screen around 200px.  I want it smaller. 

Thanks

Lee

Rumen
Telerik team
 answered on 01 Oct 2018
1 answer
119 views

Hi there,

I got 2 EF Code first tables

public class ActionGES
 {
        public int ActionGESID { get; set; }
        [MaxLength(250)]
        public string TitreAL { get; set; }
        [Required]
        public string Description { get; set; }
 
        //FK
        public ICollection<IndicateurAction> Indicateurs { get; set; }
}
 
public class IndicateurAction
{
        public int IndicateurActionID { get; set; }
        [Required]
        public int Indicateur { get; set; }
        [Required]
        public int Annee { get; set; }
        public bool ApprouveEA { get; set; }
 
        //FK Key       
        public int ActionGESId { get; set; }
        [ScriptIgnore]
        public ActionGES ActionGES { get; set; }
}

work good with LINQ with .include

My question is: it is normal that when I call Destroy on my grid, I ActionGES object are created in the controller action with FK Indicateurs collection count = 1 but with en [0] item = null...

My Controller action

//POST: Actions_Destroy
[Authorize]
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Actions_Destroy([DataSourceRequest] DataSourceRequest request, ActionGES act)
{
    if (act != null && ModelState.IsValid)
    {
        this.actionService.DeleteAction(act);
    }
 
    return Json(new[] { act }.ToDataSourceResult(request, ModelState));
}

 

The "act" variable contain a Indicator with a null item. Look the picture.

 

Konstantin Dikov
Telerik team
 answered on 01 Oct 2018
4 answers
1.1K+ views

Hi, I work with the sample GridCustomPopupTemplate but in the sample you do not show how to add an dropdownList for an ForeignKey column. In Inline mode editing all work good. But how to do it in an custom popup template?

My template for now:

@model PortailGES.Models.ActionGES
 
 
 
 
<div class="editor-label">
    @Html.LabelFor(model => model.SecteurId, "Secteur")
</div>
<div class="editor-field">
    @Html.Kendo().DropDownListFor(m => m.SecteurId)
</div>
<div class="editor-label">
    @Html.LabelFor(model => model.Titre)
</div>
<div class="editor-field">
    @Html.EditorFor(model => model.Titre)
    @Html.ValidationMessageFor(model => model.Titre)
</div>

 

The DropDownListis empty. I see that in the ViewData.Values[0].Items I got the source items for Secteur but how to make the link with the DropDownList DataSource?

Thanks

Georgi
Telerik team
 answered on 01 Oct 2018
4 answers
1.6K+ views

Wondering is there a way I can add textbox and a button so on click of a button reads textbox value and calls javascript?

Right now I am showing two buttons using following code:

.ColumnMenu(i => i.Columns(false))
        .ToolBar(toolbar => Model.ConfigureToolbar(toolbar, toolbar2 =>
        {
            if (Model.CanCreate && Model.SourceId > 0)
            {
                var caption = string.Format("Copy Items From Source ({0} {1})", OrderHelper.GetEntityLabel(Model.SourceIsQuote),
                    Model.SourceId);
                var show = new OrderItemGridCopyFromSourceLaunchInfo
                {
                    StateKey = Model.StateKey,
                    Title = caption
                };
                Model.CopySourceInfoTo(show);
                toolbar2.Custom().Text(caption + "...").Url(string.Format("javascript: order.showItemGridCopyFromSourceForm({0});", JsonConvert.SerializeObject(show)));
            }   
        }))

 

public static void ConfigureToolbar<T>(this IDialogStartInfo info, GridToolBarCommandFactory<T> toolbar,
            Action<GridToolBarCommandFactory<T>> additional) where T : class
        {
            if (info.CanCreate)
            {
                toolbar.Custom()
                    .Text(string.Format("Add {0}", info.Subject))
                    .HtmlAttributes(new {href = string.Format("javascript:{0}();", info.AddDialogFunction)});
            }
            if (additional != null)
            {
                additional(toolbar);
            }
        }

 

Stefan
Telerik team
 answered on 01 Oct 2018
3 answers
402 views

I have a Kendo Grid in an MVC view.  I've enabled paging, and added a check box to select the records.  Everything seems to work, however when I select all items on 1 page, for some reason, all items get selected across all pages instead of just on the 1 page.  If I select all items only on 1 page - all items in all subsequent pages should not be checked.  Any ideas?

@(Html.Kendo().Grid(Model.ResultFiles)
                          .Name("Grid")
                          .Columns(columns =>                           {
                              columns.Select().Width(50);
                              columns.Bound(r => r.Id).Hidden();
                              columns.Bound(r => r.SomeNumber).Title("Number").Filterable(f => f.Cell(cell => cell.ShowOperators(false))).ClientTemplate("#= SomeNumber# # if(!Viewed) { # <span id='unread-#= Id #' class='badge new-results'>New</span> # } #");
                              columns.Bound(r => r.Name).Title("Person").Filterable(f => f.Cell(cell => cell.ShowOperators(false)));
                              columns.Bound(r => r.DateOfBirth).Title("Date of Birth")
                                  .ClientTemplate("#= DateOfBirthAsString#")
                                  .Filterable(f => f.Cell(cell => cell.ShowOperators(false)));
                              columns.Bound(r => r.CompanyName).Hidden();
                              columns.Bound(r => r.SomeOtherName).Filterable(f => f.Cell(cell => cell.ShowOperators(false)));
                              columns.Bound(r => r.DisplayName).Title("Place").Filterable(f => f.Cell(cell => cell.ShowOperators(false)));
                              columns.Bound(r => r.EntryDateAsString).Title("Collection Date").Filterable(false);
                              columns.Bound(r => r.ReportGuid).Hidden(true);
                          })
                          .ToolBar(t => t.Template(@<text><label>Search By Entry Date Range:</label>                                 <div class="row">                                     <div class="col-md-3">@(Html.Kendo().DatePicker().Name("startSearch").HtmlAttributes(new { PlaceHolder = "Start Date..." }))</div>                                     <div class="col-md-3">@(Html.Kendo().DatePicker().Name("endSearch").HtmlAttributes(new { PlaceHolder = "End Date..." }))</div>                                     <div class="col-md-1"><button class="k-button" type="button" onclick="filterGrid()" style="width: 100%">Search</button></div>                                     <div class="col-md-1"><button class="k-button" type="button" onclick="resetFilter()" style="width: 100%">Reset</button></div>                                     <div class="col-md-1"><button class="k-button" type="button" onclick="downloadFiles()" style="width: 100%">Download</button></div>                                 </div></text>))
                            .Pageable(p => p.PageSizes(new int[] { 10, 25, 50, 100 }))
                            .Sortable()
                            .Filterable(ftb => ftb.Mode(GridFilterMode.Row)
                                .Operators(o => o
                                    .ForString(str => str.Clear()
                                        .Contains("Contains")
                                    )
                                )
                            )
                            .DataSource(dataSource => dataSource
                                .Ajax()
                                .Sort(sort => sort.Add("EntryDate").Descending())
                                .Read(read => read.Action("Search", "Reports"))
                                .PageSize(10)
                            )
                            .PersistSelection()
                        )
Jason
Top achievements
Rank 1
 answered on 28 Sep 2018
5 answers
1.5K+ views

I am displaying a Time field with datatype DateTime. I am displaying only time part at UI by using Data Format String  "{0:hh:mm:ss tt}")

(eg. field value:02:00:00 AM).

I want to apply filter on this field but by default filter option provides DatePicker control to select date but I want only TimePicker control to be display in filter?

I don't want display DatePicker control because its not display in grid row.

Please let me know if there are any demo for this scenario.

Georgi
Telerik team
 answered on 28 Sep 2018
1 answer
170 views

As far as I know I have to reference JS-library 'kendo.culture.de-DE.min.js' and afterwards execute 'kendo.culture("de-DE")' to use culture specific formatting, even when using the MVC wrappers, right?

But do we actually have to use the Format() function for every field (numeric column in a grid) to show the correct number format? Why does it not apply the format automatically after already setting the kendo culture? Or do I have to tell kendo otherwise?

Veselin Tsvetanov
Telerik team
 answered on 27 Sep 2018
11 answers
3.3K+ views
I am using a treelist to display groups and items. On nodes that represent groups, I want to display the Add, Edit, and Delete buttons (which I have working now). On the nodes that are items I only want to show the Delete button. How do I conditionally hide the buttons for nodes that are items and not groups?
Stefan
Telerik team
 answered on 27 Sep 2018
1 answer
571 views

We would like to implement custom server side sort logic, while using the MVC wrappers with the Server() option in the DataSource. How can we achieve this?

Currently we're using the Ajax() option with Read(), and handling the DataSourceRequest, as a workaround.

Viktor Tachev
Telerik team
 answered on 27 Sep 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?