Telerik Forums
UI for ASP.NET MVC Forum
1 answer
397 views

We are finding out that the text in a disabled cell is too difficult to read as the font color is a too light of a grey.  Is there a way to easily change the font color so that it is more readable for users?

 

Thanks.

 

Scott Rafferty

Ivan Danchev
Telerik team
 answered on 14 Mar 2017
6 answers
356 views

I have a chart that uses grouping and creates a legend at the top of the chart.  While the chart is rendering, the legend that appears at the top of the chart contains 'd NaN/NaN/0NaN' as seen in the attached screenshot.  The legends should contain dates in the format of 'ddd dd/MM/yyyy', so I'm assuming the dates are not yet known, so the legend is displaying in this way.

Is there a way of hiding this until the legend actually has data, because having 'd NaN/NaN/0NaN' show up in the chart does not look good.

Regards,

Shawn

Daniel
Telerik team
 answered on 14 Mar 2017
3 answers
640 views
Hello,

I am trying to achieve the following scenario. 

1.) Use enters the search term
2) Click search button
3) Loads the Partial View of Results Grid, (Asynchronously loading the results)

I am able to load data in the using server binding. (Passed all results in the model). I am hard time to achieve the same using Ajax data source binding. The results would load (Ajax Read operation is not invoked on the Grid)

Below is my partial view 'QueryProspects.cshtml'
@model string
 
@(Html.Kendo().Grid<SampleDataSummaryDto>()
              .Name("Grid")
              .Columns(columns =>
              {
                  columns.Bound(l => l.Id).Title("Name");
                  columns.Bound(p => p.CompanyName).Title("Company Name");
                  columns.Bound(p => p.PhoneNumber).Title("Phone");
                  columns.Bound(p => p.EmailAddress).Title("Email");
       
              })
              .HtmlAttributes(new { style = "height:450px" })
              .Scrollable()
              .DataSource(dataSource => dataSource
                  .Ajax()
                  .Read(read => read.Action("SearchResults_Read", "Prospect", new { SearchText = Model }))
              )
        )
          public PartialViewResult loadSampleData(string SearchText)
        {
            return PartialView("EditorTemplates/loadSampleData", SearchText);
        }

public ActionResult SearchResults_Read(string SearchText)
       {
           var results= myService.GetByIdentifiers(SearchText, 20);
           var dsResult = results.ToDataSourceResult(new DataSourceRequest());
           return Json(dsResult);
       }

I am passing the searchText to partial view and thinking that my Grid view use that search text asynchronously would call 'SearchResults_Read' and passing the SearchText as action param.

I appreciate any suggestions on why this is not working?

Thank You,
Uday

 



Viktor Tachev
Telerik team
 answered on 13 Mar 2017
1 answer
151 views

I have a page showing two grids, grid1 and grid2, and a separate stand alone button "export as excel"

I would like the button to make a single excel download with grid1 in worksheet1 and grid2 in worksheet2.

Q: Is this doable ?

Pavlina
Telerik team
 answered on 10 Mar 2017
1 answer
194 views

Take the following PanelBar:

@(Html.Kendo().PanelBar()
       .Name("topicList")
       .BindTo(Model, mappings =>
       {
           mappings.For<DropDownTopicList>(b => b.ItemDataBound((item, category) =>{ item.Text = category.Category; }).Children(category => category.Topics));
           mappings.For<TopicBank>(b => b.ItemDataBound((item, topic) =>{ item.Id = topic.ID.ToString(); item.Text = topic.Title + " - " + topic.Description; }));
       })
       .Events(ev => ev.Select("pbSelect"))
   )

 

How do I get the Id of the selected Item? 

Joe
Top achievements
Rank 1
 answered on 09 Mar 2017
2 answers
380 views

I'm trying to creare a new project, but I have noticed that it doesn't propose the choice of authentication type (like Microsoft template standard).

Is it correct?

Dario Concilio
Top achievements
Rank 2
 answered on 09 Mar 2017
5 answers
682 views

For the past few days I've been trying to get a grid working for a relatively complex model. I want to use a remote datasource for populating the initial grid, but for adding and editing I need to query other datasources for several columns, to get filtering and sorting in a dropdownlist.

I've encountered several problems, with things like binding the dropdowns and validating the editor. I'll post some of my code here, maybe someone here can provide a suggestion on what I'm doing wrong/forgetting.

Controller: 

// GET: Settings
        public ActionResult Index()
        {
            return View();
        }
 
        public async Task<ActionResult> GetSettings([DataSourceRequest] DataSourceRequest request)
        {
            DiscountSettingsViewModel viewModel = await _discountService.GetViewModel();
            var result = viewModel.Discounts.ToDataSourceResult(request);
            result.Total = viewModel.Discounts.Count;
 
            return Json(result, JsonRequestBehavior.AllowGet);
        }
 
public async Task<ActionResult> GetItemGroups([DataSourceRequest] DataSourceRequest request)
        {
            var queryParser = new DataSourceODataParser();
            List<ItemGroupViewModel> result = await _discountService.GetItemGroups(queryParser.Parse(request));
            return Json(new DataSourceResult {Data = result, Total = result.Count}, JsonRequestBehavior.AllowGet);
        }
 
        public async Task<ActionResult> GetItems([DataSourceRequest] DataSourceRequest request)
        {
            var queryParser = new DataSourceODataParser();
            List<ItemViewModel> result = await _discountService.GetItems(queryParser.Parse(request));
            return Json(new DataSourceResult {Data = result, Total = result.Count}, JsonRequestBehavior.AllowGet);
        }
 
        public async Task<ActionResult> GetResellers([DataSourceRequest] DataSourceRequest request)
        {
            var queryParser = new DataSourceODataParser();
            List<ResellerViewModel> result = await _discountService.GetResellers(queryParser.Parse(request));
            return Json(new DataSourceResult { Data = result, Total = result.Count }, JsonRequestBehavior.AllowGet);
        }
 
        public async Task<ActionResult> GetCustomers([DataSourceRequest] DataSourceRequest request)
        {
            var queryParser = new DataSourceODataParser();
            List<CustomerViewModel> result = await _discountService.GetCustomers(queryParser.Parse(request));
            return Json(new DataSourceResult { Data = result, Total = result.Count }, JsonRequestBehavior.AllowGet);
        }

 

ViewModels:

public class DiscountSettingsViewModel
    {
        public int SubscriptionId { get; set; }
        public List<DiscountViewModel> Discounts { get; set; }
    }
 
    public class DiscountViewModel
    {
        public int Id { get; set; }
        public ItemGroupViewModel ItemGroup { get; set; }
        public ItemViewModel Item { get; set; }
        public ResellerViewModel Reseller { get; set; }
        public CustomerViewModel Customer { get; set; }
        public DateTime? StartDate { get; set; }
        public DateTime? EndDate { get; set; }
        public bool IsExtra { get; set; }
        public double Discount { get; set; }
 
        public DiscountViewModel()
        {
            Id = 0;
            ItemGroup = new ItemGroupViewModel();
            Item = new ItemViewModel();
            Reseller = new ResellerViewModel();
            Customer = new CustomerViewModel();
            IsExtra = false;
            Discount = 0;
        }
    }
 
    public class ItemGroupViewModel
    {
        public string Code { get; set; }
        public string Description { get; set; }
 
 
        public ItemGroupViewModel()
        {
            Code = "";
            Description = "";
        }
    }
 
    public class ItemViewModel
    {
        public string Code { get; set; }
        public string Description { get; set; }
 
 
        public ItemViewModel()
        {
            Code = "";
            Description = "";
        }
    }
 
    public class ResellerViewModel
    {
        public Guid? ID { get; set; }
        public string Code { get; set; }
        public string Name { get; set; }
        public Guid? Classification1 { get; set; }
 
 
        public ResellerViewModel()
        {
            ID = Guid.Empty;
            Code = "";
            Name = "";
            Classification1 = Guid.Empty;
        }
    }
 
    public class CustomerViewModel
    {
        public Guid? ID { get; set; }
        public string Code { get; set; }
        public string Name { get; set; }
        public ResellerViewModel Reseller { get; set; }
 
 
        public CustomerViewModel()
        {
            ID = Guid.Empty;
            Code = "";
            Name = "";
            Reseller = new ResellerViewModel();
        }
    }

 

Main view:

<h2>Discount Settings</h2>
 
<script type="text/javascript">
    kendo.data.binders.widget.defferedValue = kendo.data.Binder.extend({
        init: function (widget, bindings, options) {
            kendo.data.Binder.fn.init.call(this, widget.element[0], bindings, options);
            this.widget = widget;
            this._change = $.proxy(this.change, this);
            this.widget.bind("change", this._change);
        },
        refresh: function () {
            if (!this._initChange)
            {
                var widget = this.widget;
                var value = this.bindings.defferedValue.get();
 
                if (value)
                {
                    if (widget.options.autoBind === false)
                    {
                        //Bind the widget with single item if deffered binding is used
                        widget.dataSource.data([value]);
                        widget.value(value[widget.options.dataValueField]);
                    } else
                    {
                        //set widget value directly
                        this.widget.value(value[widget.options.dataValueField]);
                    }
                }
            }
        },
        change: function () {
            this._initChange = true;
            this.bindings.defferedValue.set(this.widget.dataItem() || null);
            this._initChange = false;
        },
        destroy: function () {
            this.widget.unbind("change", this._change);
        }
    });
</script>
 
@(Html.Kendo().Grid<DiscountViewModel>()
      .Name("Discounts")
      .Columns(col =>
      {
          col.Bound(i => i.ItemGroup)
            .Title(Resource.ItemGroup)
            .ClientTemplate("#: data.ItemGroup ? data.ItemGroup.Code : '[none]' #")
            .EditorTemplateName("ItemGroupLookup")
            .Filterable(false)
            .Sortable(true);
          col.Bound(i => i.Item)
            .Title(Resource.Item)
            .ClientTemplate("#: data.Item ? data.Item.Code : '[none]' #")
            .EditorTemplateName("ItemLookup")
            .Filterable(false)
            .Sortable(true);
          col.Bound(i => i.Reseller)
            .Title(Resource.Reseller)
            .ClientTemplate("#: data.Reseller ? data.Reseller.Name : '[none]' #")
            .EditorTemplateName("ResellerLookup")
            .Filterable(false)
            .Sortable(true);
          col.Bound(i => i.Customer)
            .Title(Resource.Customer)
            .ClientTemplate("#: data.Customer ? data.Customer.Name : '[none]' #")
            .EditorTemplateName("CustomerLookup")
            .Filterable(false)
            .Sortable(true);
          col.Bound(i => i.StartDate).Title(Resource.StartDate).Format("{0:dd-MM-yyyy}");
          col.Bound(i => i.EndDate).Title(Resource.EndDate).Format("{0:dd-MM-yyyy}");
          col.Bound(i => i.IsExtra).Title(Resource.IsExtra);
          col.Bound(i => i.Discount).Title(Resource.Discount);
          col.Command(command =>
          {
              command.Edit().Text(Resource.Edit);
              command.Destroy().Text(Resource.Delete);
          }).Width(250);
      })
      .Sortable(s => s.SortMode(GridSortMode.MultipleColumn))
      .ToolBar(toolbar => toolbar.Create().Text(Resource.Add))
      .Editable(editable => editable.Mode(GridEditMode.InLine))
      .Pageable()
      .DataSource(source => source
        .Ajax()
        .PageSize(20)
        .Events(events => events.Error("error_handler"))
        .Model(m =>
        {
            m.Id(i => i.Id);
            m.Field(p => p.ItemGroup);
            m.Field(p => p.Item);
            m.Field(p => p.Reseller);
            m.Field(p => p.Customer);
            m.Field(p => p.StartDate);
            m.Field(p => p.EndDate);
            m.Field(p => p.IsExtra);
            m.Field(p => p.Discount);
        })
        .Create(update => update.Action("CreateSetting", "Settings"))
        .Read(read => read.Action("GetSettings", "Settings"))
        .Update(update => update.Action("UpdateSetting", "Settings"))
        .Destroy(update => update.Action("DestroySetting", "Settings"))
      )
      .NoRecords(Resource.NoSettings)
)

 

Example EditorTemplate:

@model NuCall.ViewModels.ItemGroupViewModel
 
@(Html.Kendo().DropDownListFor(m => m)
      .HtmlAttributes(new { data_skip = "true", data_bind = "deferredValue: ItemGroup" })
      .OptionLabel("--none--")
      .DataSource(source =>
      {
          source.Custom()
              .ServerFiltering(true)
              .ServerPaging(true)
              .PageSize(20)
              .Type("aspnetmvc-ajax")
              .Transport(transport => transport.Read("GetItemGroups", "Settings"))
              .Schema(schema => schema
                  .Data("Data")
                  .Total("Total")
                  .Errors("Errors"));
      })
      .MinLength(1)
      .AutoBind(false)
      .Filter(FilterType.StartsWith)
      .DataValueField("Code")
      .DataTextField("Code"))
Erik
Top achievements
Rank 1
 answered on 09 Mar 2017
4 answers
1,000 views

I have a grid where I'm using the popup editor, and it's a custom template (.Editable(e => e.Mode(GridEditMode.PopUp).TemplateName("EIWOStatus")))

The popup is center screen, but I have some javascript that shows or hides certain controls based on what the user is entering.  When all the controls are shown dynamically, the window is too low.  I'd like to move it up, but the window itself doesn't seem to have an ID I can grab with jQuery in order to manipulate it.

How can I move the default starting position up so that as the controls get shown, it's never too low?

Stefan
Telerik team
 answered on 09 Mar 2017
1 answer
217 views

We are using the media player to play audio

The control looks like this

http://i.imgur.com/DfXugTI.png

 

However when the control looses focus it disappears and looks like this

http://i.imgur.com/vlQadUI.png

How do we prevent this behaviour and keep the player controls shown at all times.

 

 

Viktor Tachev
Telerik team
 answered on 08 Mar 2017
9 answers
431 views

I have a batch edit grid in which my client would like to have keyboard navigation to tab between cells. The .Navigatable() method works great. Although, for certain cells given a certain condition, I need to have them be read-only. I am able to block the cell from being selected with the mouse onClick, but with Navigatable set to true, they are still able to tab into that cell. Based on my code below, is there a way to set the cell as Read-Only? Either with a Grid method or JavaScript?

Grid Code

@(Html.Kendo().Grid<Project.Models.MetricData>()
    .Name("grid") // template expression, to be evaluated in the master context
    .Columns(columns =>
    {
        columns.Bound(m => m.MetricLabel);
        columns.Bound(m => m.Numerator);
        columns.Bound(m => m.Denominator);
        columns.Bound(m => m.Rate);
    }).ToolBar(toolbar =>
    {
        toolbar.Save();
    })
    .Editable(editable => editable.Mode(GridEditMode.InCell))
    .Navigatable()
    .DataSource(dataSource => dataSource
        .Ajax()
        .Batch(true)
        .ServerOperation(false)
        .Model(model =>
            {
                model.Id(m => m.MetricKey);
                model.Field(m => m.MetricLabel).Editable(false);
            })
        .Read(read => read.Action("Binding_Metrics", "Controller"))
        .Update("UpdateMetric", "Controller")
    )
    .Events(events => { events.DataBound("DataBound"); })
)

JavaScript

<script>
    function DataBound() {
        var grid = $("#grid").data("kendoGrid");
        var gridData = grid.dataSource.view();
 
        for (var i = 0; i < gridData.length; i++) {
            //get the item uid
            var currentUid = gridData[i].uid;
            //if the record fits the custom condition find the row based on the uid and add the custom class
            var currentRow = grid.table.find("tr[data-uid='" + currentUid + "']");
 
            var disableCell = $(currentRow).find(':nth-child(4)');
            $(disableCell).addClass("disabled"); //Greys out cell background
 
            $(disableCell).click(function (e) {
                e.preventDefault();
                e.stopImmediatePropagation();
                return false;
            });
        }
    }
</script>

I have tried to do something like this

model.Field(m => m.Rate).Editable(@<text>function(){
                                if(#=numFormat# == 1){return false;}
                                else{return true;}
                          }</text>);

But the method is unable to accept a lambda expression.

Also I have tried using JavaScript to prevent this as well

$(disableCell).focus(function (e) {
    e.preventDefault();
    e.stopImmediatePropagation();
    return false;
});

Viktor Tachev
Telerik team
 answered on 08 Mar 2017
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?