Telerik Forums
UI for ASP.NET MVC Forum
1 answer
65 views
I want for example to select from list Cotton
I  select the cotton,now will show me the cotton is selected,is all fine until here and now i want to clear my selection pressed "X"button,with mouse on pc working but if u are on Ipad(touchscreen) doesnt work the button "X" 
Ivan Danchev
Telerik team
 answered on 14 Mar 2017
4 answers
124 views
Hello , I have a issue ,when i want to clear some data from combobox after selected the  "X" button combox does not work on Chrome (Windows) using the touch,i have  this problem on  pc touch  with Windows 10 use Chrome.
Ivan Danchev
Telerik team
 answered on 14 Mar 2017
1 answer
250 views

Hi,

I have problem with getting seleted dataitem to controller from AutoComplete. This work only in popup editor on grid, but with Ajax.BeginForm not :(, I don't know how popup editor submit data to controler but it send complete dataitem. If I use AutoComplete on Window in Ajax.BeginForm it send only string value.

Please can you help me with this. I don't want use ComboBox.

 

Best regards,

Ludek

Ivan Danchev
Telerik team
 answered on 14 Mar 2017
1 answer
329 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
219 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
541 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
104 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
130 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
298 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
607 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?