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

I have an MVC Razor app with the Kendo Grid using the popup editor modeled on the demo.  The popup comes up OK, and the model is invoked and does it's validation steps.  I do not use Entity Framework, the model has validation logic that applies business rules.  My problem is that when validation fails, or succeeds for that matter, the demo does not show what to return to the view/grid.  How are errors formatted for example? 

My other question is what to return if successful?  The object the controller got from the editor is a singular object, not IQueriable or IEnumerable.  My grid is populated with data, and the model has already done the insert to the database if validation passed.  Do I refresh the grid, and if so, how can I make sure the user is kept in the same section of the grid?

My controller code for Create is shown below (the return code shows an Intellisense error you can't see here):

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult EditingPopup_Create([DataSourceRequest] DataSourceRequest request, BuyerAssignmentRecord bar)
{
    if (bar != null)
    {
        if (bar.DepartmentOI == 0) { bar.DepartmentOI = -1; }
        if (bar.EmployeeOI == 0) { bar.EmployeeOI = -1; }
 
        if (bar.Validate())
        {
            bar.Create();
        }
        else
        {
            // todo: what to return if validation failed?
        }
    }
    return Json(new[] { BuyerAssignmentRecord }.ToDataSourceResult(bar, ModelState));
}

Boyan Dimitrov
Telerik team
 answered on 15 Jan 2016
11 answers
656 views

I am using a dropdownlist in grid. The value is showing correctly in the column but when I click on the the column, the dropdownlist comes without the selected value. I have attached 3 images.

 

I need the value to be selected when I will click on the column and the dropdownlist will appear with that value. In my case when I will click on the column, the dropdownlist will appear with "DB" selected. And then I can change another value if I want. How can I do that?

 

 

Thanks

Kevork
Top achievements
Rank 2
 answered on 14 Jan 2016
1 answer
445 views

Hello, 

the AuthorizeAttribute does for well initial authorization and authentication and for actions that return views, but it doesn't work for grid commands such as save. Well it actually prevent the saving process, but the routing to the error-action doesn't work properly, because the save-command doesn't expect a view to be returned.

 

Rather than redirecting I'd like to hide commands/toolbar-items based on the role a user has in our database, but so far I only found an option like this based on AD-roles. Is there any way for me to do this?

Dimo
Telerik team
 answered on 14 Jan 2016
1 answer
3.5K+ views

I cannot create a grid in my MVC 6 application. I get "The kendo.aspnetmvc.min.js script is not included."

I am trying to run with the 30-day trial. I cannot find that js in the lib folder.

Dimo
Telerik team
 answered on 14 Jan 2016
1 answer
99 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
145 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
146 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
514 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
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
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
DateTimePicker
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?