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

I have a gantt on a page. The GanttTask object has Creator and Modifier on them and they need to be set on the client (so using javascript code).

I have attached to the save event like this

Html.Kendo().Gantt<ViewModel, DependencyViewModel>(),Name("gantt").Events(e => e.Add("onAdd").Save("onSave"))

and the javascript code

function onSave(e) {
  e.task.ModifiedBy = '@Html.Action("GetCurrentUser", "XXX")';
  e.task.ModifiedDate = new Date(Date.now());
}

When I change a task everything works as expected. However if I change a child task by changing the end date that affects also the parent I need to set the Modifier on that parent too.  

Is there an event called before updating the parents that I could use to set the Modifier ? How can I get the parents that are going to be updated in the onSave event?

Ivan Danchev
Telerik team
 answered on 25 Sep 2018
2 answers
759 views

We're attempting to do custom filtering on the server-side by passing additional data via the filters. However these custom filters do not correlate to any of the properties of the result set so we end up with an error:

Invalid property or field - 'GroupNameId' for type: InventorySearchResult

Unfortunately its not as simple as adding the GroupNameId to the result because GroupNameId is in a collection of Group Names, example:

MyEntity {
 Id = 1,
 Name = "name",
 GroupNames = <Collection of Group Names that I want to further filter against>
}

So what we do is query our data via IQueryable, extract the GroupNameGid filter from Request.Filters, then manually apply a filter for GroupNameGid to the expression, then we return the data via ToDataSourceResult(...). Unfortunately this results in the error mentioned above. I thought maybe I could remove the GroupNameGid filter from Request.Filters since I'm manually applying the filter and let ToDataSourceResult apply the rest of its magic. However this turned out to be rather complicated due to CompositeFilterDescriptor. So I'm curious to know if there is any way to easily remove a specific filter from request.Filters.

Thanks

Denny
Top achievements
Rank 1
 answered on 24 Sep 2018
4 answers
680 views

Hi 

I have problem binding DateTime field. I modified your example :https://demos.telerik.com/aspnet-mvc/spreadsheet/datasource

and added 

 [DataType(DataType.Date)]
        public DateTime TimeTest 
        {
            get;
            set;
        } = DateTime.Today;

to SpreadsheetProductViewModel.cs 

It displays the TimeTest field properly in excel sheet, but if I modify the date and submit the change, ModelState validation fails with following error:

The models contain invalid property values.The value 'Sat Jan 20 2018 00:09:00 GMT-0800 (Pacific Standard Time)' is not valid for TimeTest.

 

Please advice,

Thank you,

 

 

 

 

 

 

 

Joana
Telerik team
 answered on 24 Sep 2018
2 answers
712 views

I've got a grid set up as follows, where I'm trying to implement a basic multi-column search with an array of filters:

@(Html.Kendo().Grid<OpenPurchaseOrder>()
          .Name("grid")
          .DataSource(dataSource =>
            dataSource.Ajax()
              .Read(read => read.Action("OpenPurchaseOrders_Read", "GoodsIn"))
          )
    .ToolBar(toolbar =>
    {
      toolbar.Template(@<text>
                         <div class="toolbar">
 
                           <div class="row">
                             <div class="col-md-4">
                               <div class="input-group">
                                 <span class="input-group-addon"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></span>
                                 <input type="text" class="form-control" id='FieldFilter' placeholder="Search for...">
                                 <span class="input-group-btn">
                                   <button class="btn btn-default" type="button"><span class="glyphicon glyphicon-refresh" aria-hidden="true"></span></button>
                                 </span>
                               </div>
                             </div>
                           </div>
                         </div>
                        </text>);
    })
     
    .Pageable()
              .Filterable()
              .Sortable()
              .Navigatable()
              .Columns(columns =>
              {
                var colHeadingStyle = "white-space: normal; vertical-align: top;";
 
                columns.Bound(docType => docType.PurchaseId)
                  .HeaderHtmlAttributes(new { style = colHeadingStyle });
                columns.Bound(docType => docType.ContactName)
                  .HeaderHtmlAttributes(new { style = colHeadingStyle });
                columns.Bound(docType => docType.PoType)
                  .HeaderHtmlAttributes(new { style = colHeadingStyle });
                columns.Bound(docType => docType.PoDate)
                  .HeaderHtmlAttributes(new { style = colHeadingStyle }).Format("{0:dd MMM yyyy}");
          //columns.Command(commands =>
          //{
          //  commands.Select();
          //}).Title("").Width(180);
          columns.Bound(p => p.PurchaseId).ClientTemplate(
                  "<a class='btn  btn-default' href='" +
                  Url.Action("Create", "GoodsIn") +
                  "?PurchaseId=#= PurchaseId #'" +
                  ">Receive</a>"
                  ).Title("").Width(80).Filterable(false);
              }))

 

<script type="text/javascript">
  $(document).ready(function () {
    $("#FieldFilter").keyup(function () {
 
      var value = $("#FieldFilter").val();
      var grid = $("#grid").data("kendoGrid");
 
      if (value) {
        grid.dataSource.filter({
          logic: "or",
          filters: [
            {
              field: "PurchaseId",
              operator: "eq",
              value: value
            },
            {
              field: "ContactName",
              operator: "contains",
              value: value
            },
            //{
            //  field: "PoDate",
            //  operator: "equals",
            //  value: value
            //}
          ]
        });
      } else {
        grid.dataSource.filter({});
      }
    });
  }); 
</script>

 

And the data source is a list of these:

public class OpenPurchaseOrder
{
    [Display(Name = "Supplier")]
    public string ContactName { get; set; }
    [Display(Name = "PO No")]
    public int PurchaseId { get; set; }
    public int? DeliverTo { get; set; }
    [Display(Name = "PO Type")]
    public string PoType { get; set; }
    [Display(Name = "PO Date")]
    public DateTime? PoDate { get; set; }
}

 

That works fine if I comment out either the PurchaseId filter or the ContactName filter, but if I have them both I get System.FormatException: 'Input string was not in a correct format.' .  I'm guessing that's because one column contains a string field and the other contains an int field?  Is there any way to get round that?

I'm guessing that's because 

 

 

 

 

 

Tom
Top achievements
Rank 1
 answered on 22 Sep 2018
1 answer
156 views

Sheet does not fit properly with in the content area when working with server side import excel.Find the attached screen shot for your reference. Please provide solution for this issue.

 

Example of server side import code:

 var path = Server.MapPath("~/Excel/Dummy.xlsx");
var workbook = Telerik.Web.Spreadsheet.Workbook.Load(path);

 return Content(workbook.ToJson(), Telerik.Web.Spreadsheet.MimeTypes.JSON);

Ivan Danchev
Telerik team
 answered on 21 Sep 2018
1 answer
482 views

I'm not sure what control or group of controls would best be used to accomplish the following:

 

I need a page for reviewing submitted images(look similar to a carousel)
- At any given time a Reviewer may have 1000 images to review.  They can either skip(arrow right), accept(button) or reject(button).
- If they skip, it should go to the next image
- Once they have skipped any images they should be able to go back(arrow left)
- If they accept or reject, it should remove that image from the queue and go to the next image

- A page with a control to view a single image, description and name
- Buttons for accept and reject
- Left and Right arrow buttons to advance or go back(to skipped images only)
- At any given time there may be 1000 images to review so we don't want to hold them all in memory or go to the database for each one...maybe get 10 at a time and when we have zero go get 10 more?

Preslav
Telerik team
 answered on 21 Sep 2018
3 answers
302 views

Hi,

I'm doing my first SPA application and things are going relatively well. 

One annoying glitch that I've noticed is that since my app is on the default route, the router reacts to the fully qualified route as a different page and reloads it.

E.g. http://localhost:5849/#/alert is not the same as http://localhost:5849/Home/Index/#/alert even though it really is.

I can certainly understand why this is happening.

My question, before I go off and spend a couple days coming up with my own unique hack for this, is there an established method for handling this situation?

Thanks,

Will

Ivan Danchev
Telerik team
 answered on 21 Sep 2018
1 answer
312 views
Sheet does not fit properly with in the content area when working with server side import excel.Find the attached screen shot for your reference. Please provide solution for this issue.

Example of server side import code:

 var path = Server.MapPath("~/Excel/Dummy.xlsx");
var workbook = Telerik.Web.Spreadsheet.Workbook.Load(path);

 return Content(workbook.ToJson(), Telerik.Web.Spreadsheet.MimeTypes.JSON);
Ivan Danchev
Telerik team
 answered on 20 Sep 2018
2 answers
666 views

HI, I try to search and I can't found a way to handling the circular reference error caused when serialize DataSourceResult containing EF FK with Include.

For exemple my 2  EF class:

public class ActionGES
 {
     public int ActionGESID { get; set; }
     [Required]
     public int MunicipaliteId { get; set; }
     [MaxLength(250), Required]
     public string Titre { get; set; }
     [Required]
     public string Description { get; set; }
     [Required]
     public int AnneeDepart { get; set; }
     [Required]
     public int AnneeCible { get; set; }
     [Required]
     public int ObjectifCible { get; set; }
     [Required]
     public string UniteIndicateur { get; set; }
     public ICollection<IndicateurAction> Indicateurs { get; set; }
 
     public int SecteurId { get; set; }
     public Secteur Secteur { get; set; }
 
     public int Ordre { get; set; }
     public string FormuleGES { get; set; }
     public string ImageUrl { get; set; }
     public bool ApprouveEA { get; set; }
 
     [Required]
     public bool Archive { 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; }
     public ActionGES ActionGES { get; set; }
 }

The EF line for the Get (called be the controller)

var ctx = new PortailGESContext();
Actions = ctx.Actions.Where(a => a.Archive == false & a.MunicipaliteId == MunicipaliteId).OrderBy(o => o.Ordre).Include(s=>s.Secteur).Include(s => s.Indicateurs);

Then the controller action:

//GET: ActionSommaire_Read
[Authorize]
public async Task<ActionResult> Actions_ReadAsync([DataSourceRequest]DataSourceRequest request)
{
    IQueryable<ActionGES> actions;
 
    if (Session["MunicipaliteIdSel"] != null && Convert.ToInt32(Session["MunicipaliteIdSel"]) > 0)
    {
        actions = this.actionService.GetActionsActive(Convert.ToInt32(Session["MunicipaliteIdSel"]));
    }
    else
    {
        actions = Enumerable.Empty<ActionGES>().AsQueryable();
        ModelState.AddModelError("Error: no ID...", "");
    }
     
    DataSourceResult dsResult = await actions.ToDataSourceResultAsync(request, ModelState);
 
 
 
    return Json(dsResult, JsonRequestBehavior.AllowGet);           
}

 

This give me a circular reference when serializing Json. After reading on the web, I try to add this line to convert myself in JSON before returning it to the view:

var result = JsonConvert.SerializeObject(dsResult, Formatting.None,
                           new JsonSerializerSettings
                           {
                               ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                           });

This time the convertrion work well with out circular reference, but the Json receive by the view is not the same. So the grid do not work.

Result with Json(result):  {"Data":[{"ActionGESID":1,"MunicipaliteId":1,"Titre":"test" ......
Result with JsonConvert.SerializeObject:  "{\"Data\":[{\"ActionGESID\":1,\"MunicipaliteId\":1,\"Titre\":\"Test\" .....

Any idea to handle this?

Thanks

 

 

Pierre
Top achievements
Rank 2
Iron
Iron
 answered on 20 Sep 2018
7 answers
641 views

I have a kendo list view in which there are two columns. Each column has a separate tooltip. 

The issue I am having is once I hover from one column to the other the first column tooltip does not disappear. So it displays both the tooltips. How can I fix the issue.  I am using VS 2015 Professional with .Net Framework 4.6.2. The Kendo library I am using is Kendo.Mvc (2017.3.1018.545). The browser is in chrome 68.0.3440.106 and IE 11

Below is the declaration of the same. Also I made sure I used different css class for both the columns.

@(Html.Kendo().Tooltip()

      .For("#Documents")
      .Filter(".descriptionTooltip")
      .ContentHandler("getDescriptionTooltip")
      .Position(TooltipPosition.Right)
      .AutoHide(false).Width(300).Height(100).ShowOn(TooltipShowOnEvent.MouseEnter))
    

    @(Html.Kendo().Tooltip()
      .For("#Documents")
      .Filter(".commentsTooltip")
      .ContentHandler("getCommentsTooltip")
      .Position(TooltipPosition.Right)
      .AutoHide(false).Width(300).Height(100).ShowOn(TooltipShowOnEvent.MouseEnter))

-------------------------------

<script type="text/x-kendo-tmpl" id="SDtemplate">

    <div style="border:none; border-style:none;" >
        <table cellspacing="5" cellpadding="5" border="1" style="padding:5px;border-spacing:5px;border-bottom:1px solid \\#ddd;">
            <tr>
                <td style="width:10px;text-align:center">
                    <strong>&\\#8226;&nbsp;&nbsp;</strong>
                </td>
                <td width="150px">                    
                    &nbsp;&nbsp;#if(Description != null && Description.length <= 20) {# <span>#=Description #</span> #} else if(Description == null) {# &nbsp;  #} else {# <span class='descriptionTooltip'>#=DescriptionShort #</span>  #}#
                </td>
                <td width="150px">
                    &nbsp;&nbsp;#if(Comments != null && Comments.length <= 20) {# <span>#=Comments #</span> #} else if(Comments == null) {# &nbsp;  #} else {# <span class='commentsTooltip'>#=CommentsShort #</span>  #}#
                </td>               
               
            </tr>
        </table> 
    </div>
</script>

-------------------------------------------------

@(Html.Kendo().ListView(Model.Documents)
    .Name("Documents")
    .TagName("div")
    .HtmlAttributes(new { style = "border:none; border-style:none;" })
    .ClientTemplateId("SDtemplate")
    .DataSource(dataSource => dataSource
                        .Batch(false)
                        .ServerOperation(false)
                        .Model(model => model.Id(p => p.DocumentID))
                        .PageSize(5)
                    )
    .Selectable(s => s.Mode(ListViewSelectionMode.Single))
    .Pageable(page =>
    {
        page.PageSizes(false);
        page.PreviousNext(false);
        page.Input(false);
        page.PageSizes(new int[] { 5, 10, 20, 50, 100, 500 });
        page.Enabled(false);
    })
                                    )

------------------------

function getDescriptionTooltip(e) {

        var dataItem = $("#Documents").data("kendoListView").dataItem(e.target.closest("tr"));
        var content = dataItem.Description;
        return content;
    }

    function getCommentsTooltip(e) {
        var dataItem = $("#Documents").data("kendoListView").dataItem(e.target.closest("tr"));
        var content = dataItem.Comments;
        return content;
    }

Sriram
Top achievements
Rank 1
 answered on 20 Sep 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?