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

Hi,
       I am using Custom Editor Template in my Scheduler. Can you please tell me as how to include tab in the Custom Editor Template?

 When trying to add tab using below code

 

<div id="tabExample" style="float:left;width:98%;font-size: 1.1em !important;">
<ul>   
        <li><a href="#tab1">Tab1</a></li>   
        <li><a href="#tab2">Tab2</a></li
        </ul>
        </div>
 
//And in Script
<script type="text/javascript">
        $(document).ready(function () {
 $("#tabExample").tabs();
 });
</script>

 

I am getting javascript error like "Invalid Template".

Can you help me on this.

 

Thanks,

Dilip

 

 

Vladimir Iliev
Telerik team
 answered on 14 Jan 2016
3 answers
149 views

I tried this sample code from here: http://docs.telerik.com/kendo-ui/aspnet-mvc/helpers/spreadsheet/overview

and I don't get anything that renders on the view. I am also wondering where I can find some advanced examples of the spreadsheet control as I need to be able to freeze panes disable tool bar items or make them not show and so on.

 

Regards.

Dimiter Madjarov
Telerik team
 answered on 14 Jan 2016
7 answers
1.6K+ views

My dates pickers are showing no values when loaded, if I look at source I can see that they have a value, but it is not showing. you can see below that value is present.

HTML generated 

<span class="k-widget k-datepicker k-header"><span class="k-picker-wrap k-state-default"><input name="StartDate" class="k-input" id="StartDate" role="combobox" aria-disabled="false" aria-expanded="false" aria-readonly="false" aria-owns="StartDate_dateview" style="width: 100%;" type="text" value="2015/09/05" data-role="datepicker" data-val-required="The StartDate field is required." data-val="true" data-val-date="The field StartDate must be a date."><span class="k-select" role="button" aria-controls="StartDate_dateview" unselectable="on"><span class="k-icon k-i-calendar" unselectable="on">select</span></span></span></span>

 

 MVC config

@Html.Kendo().DatePickerFor(Function(m) m).Format("yyyy/MM/dd").ParseFormats({"dd-MM-yyyy", "dd/MM/yyyy", "MM/dd/yyyy", "yyyy/MM/dd", "yyyy-MM-dd"}).Value(Model)

Thanks

Gary Davis
Top achievements
Rank 2
 answered on 13 Jan 2016
1 answer
149 views

Hi, i am using MVC CHART CONTROL.  Is it possible set the categoryAxis title according to a dropdown list's selected value.

 when the user click the update button, It will call

 

 var ochart = $("#chart").data("kendoChart");
 ochart.dataSource.read();

 

that works well and chart area will be updated accoriding settings. based on it, I would like to change the axis title as well. but if i tried to

ochart.options.categoryAxis.title = "something else";

the title just disappeared.

I have spent a few hours on it. please anyone can give me a hand?

 

thanks

Dimiter Topalov
Telerik team
 answered on 13 Jan 2016
3 answers
521 views

Hello everyone,

 

Currently I've got three ComboBoxes:

  1. Country
  2. State
  3. City

When user selects a country the next two ComboBoxes will show some values based on the first value. Example:

If country is "United States", the state will show all of the states in the U.S and city will show all of the cities in the U.S.. What I need to do this is to add another condition to select cities based on State if available because not all countries have states.

 

Following is my code for Cities:

public JsonResult GetCascadeCities(string countries, string states, string cityFilter)

        {
            var cities = db.GeoDD.AsQueryable();

            if (countries != null)
            {
                cities = cities.Where(p => p.CountryCode == countries);
            }
            
            if (!string.IsNullOrEmpty(cityFilter))
            {
                cities = cities.Where(p => p.City.Contains(cityFilter));
            }
            return Json(cities.Where(p => p.Deleted == false).Select(p => new { City = p.City }).Distinct().OrderBy(p => p.City), JsonRequestBehavior.AllowGet);
        }

 

So how can I make it so that if a country has state then city should be populated based on Country and State and if not then Country should be the only condition.

 

Please advice,

Alex

Georgi Krustev
Telerik team
 answered on 13 Jan 2016
4 answers
2.2K+ views

Im having problems getting the multi select change event to fire.

 

Initially i thought it could be something to do with my functions so i've tried copying all the event functions exactly as shown on the demo page. 

Using the multi select box, i can see all the events are firing EXCEPT for the change event. (e.g. open, selected, closed, databound works)

 

Is there any reason why only the change function is not firing? I need the change function as theres logic to be done when an item is selected or deleted from the list.

 

This is what my multi select looks like:

01.@(Html.Kendo().MultiSelectFor(m => m.Ids)
02.    .DataTextField("Description")
03.    .DataValueField("Id")
04.    .Filter("contains")
05.    .Placeholder("Please select an item...")
06.    .Events(e => e.Change("onChange").Select("onSelect").Open("onOpen").Close("onClose").DataBound("onDataBound").Filtering("onFiltering"))
07.    .DataSource(source =>
08.    {
09.        source.Custom()
10.            .ServerFiltering(true)
11.            .ServerPaging(true)
12.            .PageSize(80)
13.            .Type("aspnetmvc-ajax")
14.            .Transport(transport =>
15.            {
16.                transport.Read("GetItems", "Items");
17.            })
18.            .Schema(schema =>
19.            {
20.                schema.Data("Data").Total("Total");
21.            });
22.    })
23.    .Virtual(v => v.ItemHeight(26).ValueMapper("itemsValueMapper"))
24.    .Value(Model.Items)
25.)
 

 And javascript is just your basic event functions

 

01.function onOpen() {
02.    console.log("event: open");
03.}
04. 
05.function onClose() {
06.    console.log("event: close");
07.}
08. 
09.function onChange() {
10.    console.log("event: change");
11.}
12. 
13.function onDataBound() {
14.    console.log("event: dataBound");
15.}
16. 
17.function onFiltering() {
18.    console.log("event: filtering");
19.}
20. 
21.function onSelect(e) {
22.        var dataItem = this.dataSource.view()[e.item.index()];
23.        console.log("event :: select (" + dataItem.Text + " : " + dataItem.Value + ")");
24.}

 

 Thanks

Jaesoon
Top achievements
Rank 1
 answered on 12 Jan 2016
3 answers
669 views

This grid works for Read, Update (of existing record only) and Delete, but when Creating a new row, the Update button doesn't work. (When creating a new row, the Cancel button does work).

e.g.

After Reading data from server:

 - Click Edit button on existing row. Make changes. Click Update. Success!

 - Click Delete button on existing row. Success!

 - Click Add new record button. New row appears. Click Cancel. Success!

 - Click Add new record button. New row appears. Click Update. Nothing happens. Controller method is not called.

What is wrong?

Thanks

Grid:

 

@(Html.Kendo().Grid<PublicUserMunicipalityViewModel>()
       .Name("publicUserMunicipalitiesGrid")
       .Columns(columns =>
         {
           columns.Bound(u => u.Id).Hidden();
           columns.Bound(u => u.PublicUserId).Hidden();
           columns.Bound(u => u.UserId).Hidden();
           columns.Bound(u => u.muni_code).Hidden();
           columns.Bound(u => u.Municipality).ClientTemplate("#=Municipality.MuniCombo#");
           columns.Bound(u => u.RequestedDate).Hidden();
           columns.Bound(u => u.Granted).Hidden();
           columns.Bound(u => u.CanSubmitForms).ClientTemplate("<input type='checkbox' disabled='disabled' #= CanSubmitForms ? checked='checked' : '' # ></input>");
           columns.Bound(u => u.SuperUser).ClientTemplate("<input type='checkbox' disabled='disabled' #= SuperUser ? checked='checked' : '' # ></input>");
           columns.Bound(u => u.IsCurrent).Hidden();
           columns.Command(command => { command.Edit(); command.Destroy(); }).Width(180);
         })
       .ToolBar(toolbar => toolbar.Create())
       .DataSource(dataSource => dataSource
          .Ajax()
          .Model(model =>
            {
              model.Id(p => p.Id);
              model.Field(p => p.Id);
              model.Field(p => p.PublicUserId);
              model.Field(p => p.UserId);
              model.Field(p => p.muni_code);
              model.Field(p => p.Municipality).DefaultValue(ViewData["defaultMunicipality"] as MunicipalityViewModel);
              model.Field(p => p.RequestedDate);
              model.Field(p => p.Granted);
              model.Field(p => p.CanSubmitForms);
              model.Field(p => p.SuperUser);
              model.Field(p => p.IsCurrent);
            })
          .Read(read => read.Action("PublicUserMunicipalityViewModelsRead", "PublicUserMunicipalityViewModels")
                          .Data("getSelectedPublicUserId"))
          .Create(create => create.Action("PublicUserMunicipalityViewModelsCreate", "PublicUserMunicipalityViewModels")
                              .Data("getSelectedPublicUserId"))
          .Update(update => update.Action("PublicUserMunicipalityViewModelsUpdate", "PublicUserMunicipalityViewModels"))
          .Destroy(destroy => destroy.Action("PublicUserMunicipalityViewModelsDestroy", "PublicUserMunicipalityViewModels"))
       )
)

Controller Method:

public ActionResult PublicUserMunicipalityViewModelsCreate([DataSourceRequest]DataSourceRequest request, PublicUserMunicipalityViewModel publicUserMunicipalityViewModel, int publicUserId)
{
  // Set UserId and PublicUserId
  publicUserMunicipalityViewModel.PublicUserId = publicUserId;
 
  var publicUser = db.PublicUsers.FirstOrDefault(pu => pu.Id == publicUserId);
  publicUserMunicipalityViewModel.UserId = publicUser.UserId;
   
  // Clear the ModelState errors these two required fields had as they were passed in null.
  ModelState["PublicUserID"].Errors.Clear();
  ModelState["UserID"].Errors.Clear();
 
  if (ModelState.IsValid)
  {
    // Create a new PublicUserMunicipality entity and set its properties from the posted PublicUserMunicipalityViewModel
    var entity = this.BuildPublicUserMunicipalityEntity(publicUserMunicipalityViewModel);
 
    // Add the entity
    db.PublicUserMunicipalities.Add(entity);
 
    // Delete the entity in the database
    db.SaveChanges();
 
    // Get the Id generated by the database
    publicUserMunicipalityViewModel.Id = entity.Id;
  }
 
  // Return the inserted contract. Also return any validation errors.
  return Json(new[] { publicUserMunicipalityViewModel }.ToDataSourceResult(request, ModelState));
}

Greg
Top achievements
Rank 1
 answered on 12 Jan 2016
3 answers
105 views

Hi ,

i have an issue with telerikTimePicker it is really random one . when the client try to select a time from the time picker it only show two selection 12:00 AM and 12:00 AM  when he refresh the page it show the whole list  from 12:00 Am till 11:45 PM . this only happen in  mobile devices found in both android and apple devices 

this is a screenshot 

http://screencast.com/t/9kZW4V3IP98y

Ianko
Telerik team
 answered on 12 Jan 2016
5 answers
899 views

I have a PartialView which is updated using AJAX. The HTML elements are loaded correctly when updating the Div using AJAX, but the Telerik chart is not loaded. The datasource in the chart is not calling the Action method:

.DataSource(ds => ds.Read(read => read.Action("Movies_Read", "Movies")))

When the PartialView is initially loaded, not using AJAX, the datasource is calling the action method and the chart is loaded correctly.
According to Telerik ASP.NET PartialView AJAX there needs to be this Javascript call for the OnSuccess event:

<script type="text/javascript"> function updatePlaceholder(context) { // the HTML output of the partial view var html = context.get_data(); // the DOM element representing the placeholder var placeholder = context.get_updateTarget(); // use jQuery to update the placeholder. It will execute any JavaScript statements $(placeholder).html(html); // return false to prevent the automatic update of the placeholder return false; }

I have tried the javascript mentioned in the documentation, but the get_data() and get_updateTarget() does not exists event though I havde added the MicrosoftAjax.js and MicrosoftMvcAjax.js. I suspect that these are deprecated. I have also tried other javascript functions but without any luck.
My AJAX call is:

@using (Ajax.BeginForm("UpdateMoviesChart", "Movies", new AjaxOptions { UpdateTargetId = "MoviesDiv", InsertionMode = InsertionMode.Replace, OnSuccess = "updatePlaceholder", }))

How do I load the Telerik Chart correctly when using AJAX?

Vladimir Iliev
Telerik team
 answered on 12 Jan 2016
7 answers
1.7K+ views

Hi,

according to what is written in this answer, binding a grid on initial page (or view) load using BindTo will prevent the Ajax request (if there is any data).
IMHO, even if the there is no data, if I explicitly bind the grid, it should not make any other attempt to get the data.

Anyway, how can I prevent the request even if there is no initial data?

Thank you.

 

Kiril Nikolov
Telerik team
 answered on 12 Jan 2016
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
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
Licensing
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
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?