Telerik Forums
UI for ASP.NET MVC Forum
2 answers
455 views
Hi!

I have a serverbound (ajax) grid and want to add a custom argument when fetching data.

After some searching I found the option to alter the parameterMap function. However, when I try to extend that function I extend the original functionality, not the one provided by kendo.aspnetmvc.js. This means that my custom argument works, but sort/filter/... does not anymore. When I remove my code sort/filter/... works but of course my custom data does not get through.

Is there any way to add my custom argument? Below is the code I tried for reference:
$("#myGrid").data("kendoGrid")
    .dataSource.transport.parameterMap = function (data, operation) {
        return $.extend(data, {
            myCustomData: true  //Actually client-side calculated data, not static
        });
    };



Thanks
/Victor
Victor
Top achievements
Rank 1
 answered on 26 Dec 2012
1 answer
219 views
Hello, I'd like to trigger a databind/search of the MVC AutoComplete programmatically instead of in reaction to a user typing. Is this possible?
Alexander Valchev
Telerik team
 answered on 25 Dec 2012
1 answer
194 views
I have a question regarding to Date format for Calendar controls inside ColumnMenu filter for Column with Date type. As you can see here, on attached screenshot I use a Denmark (<globalization culture="da-DK" uiCulture="da-DK" />) localization defined in Web.config. And all is ok except Calendar date format, that is US. All other calendars that I used out of this filter are configured to format "dd-MM-yyyy". But how to configurate this one, inside a filter?
Petur Subev
Telerik team
 answered on 25 Dec 2012
1 answer
151 views
Hello,
how can i execute an action from the controller,on clicking a menu item?

Also,the menu can be align vertically?or for that is the other control,the panel bar?

Thanks in advance
Dimo
Telerik team
 answered on 25 Dec 2012
2 answers
515 views
Hello,

  We are evaluating KendoUI to use in our company. One of the primary requirement for us is to have custom column filter only with a single textbox on each column without any menus, operators and buttons. When the user types something on the textbox I have to execute 'Contains' filter in server side. What is easiest way to do this? Please check the attached picture.
Atanas Korchev
Telerik team
 answered on 24 Dec 2012
1 answer
237 views
I am trying to use a dropdownlist as an editor template (using MVC Complete) and having several issues/questions.

1.) The binding works on Save, but not on Read: i.e. when I select an option and save the model, the correctly selected item's value is saved to the database, but then when pulling up that record again, the DDL is not reflecting that saved value. I have verified that value is in the Database and is in the view model.

2.) Can you bind to the View's model instead of the ViewData? i.e. .BindTo(Model.DDLOptions.CustomerOptions). When I try this I get an error "

'int' does not contain a definition for 'DDLOptions'


3.) Should the .Name value match the Property Name or the name as it is in the model. i.e. since my model has multiple sub-classes, it seems that I need to use a .Name that corresponds to the way the model references that field. In the view, I'd reference the OwnerId field as @Html.EditorFor(model => model.Item.OwnerId). As such I am using a .Name("Item.OwnerId"). This results in the issues listed in item 1...only 1 way binding. If I change it to .Name("OwnerId"), the base classes property name, no binding occurs at all.

Property decorated with UIHint in MetaData class for Base Class: This is for the Item class
[Display(Name = "Owner Id")]
[UIHint("CustomersAllDDLEditor")]
public Nullable<int> OwnerId { get; set; }
View Model
public class ItemViewModel
    {
        public Item Item { get; set; }
        public ItemOptionsViewModel DDLOptions { get; set; }
        public AuditStampsViewModel AuditStamps { get; set; }
    }
EditorTemplate
@(Html.Kendo().DropDownList()
    .Name("Item.OwnerId")
    .DataValueField("Id")
    .DataTextField("DisplayName")
    //.BindTo(Model.DDLOptions.CustomerOptions)
    .BindTo((System.Collections.IEnumerable)ViewData["customers"])
    .OptionLabel(" ")
    .Template("#= data.DisplayName.replace(' ', ' ') #")
)
How this property is reference in the View
@Html.EditorFor(model => model.Item.OwnerId)
If I place the Kendo DDL directly in the view, without using the editortemplate, here is the HTML output for Input element:
<input data-val="true" data-val-number="The field Owner Id must be a number." id="Item_OwnerId" name="Item.OwnerId" type="text" value="3" class="k-input valid" data-role="dropdownlist" style="display: none;">
When the Kendo DDL is displayed via the EditorTemplate, here is the resulting HTML
<input id="Item_OwnerId" name="Item.OwnerId" type="text" class="k-input valid" data-role="dropdownlist" style="display: none;">
Note in the latter it is missing the Value=3 attribute as well as the validation attributes.

Any help is appreciated.
Chad

Atanas Korchev
Telerik team
 answered on 24 Dec 2012
2 answers
338 views
We are currently evaluating the various different ways of binding our Backend code to the Kendo UI Grid control.

We have a Ajax enabled Controller and View which successfully uses a EditorTemplate to display a dropdown thus :


    @(Html.Kendo().Grid(Model)
                      .Name("EmployeesGrid")
                      .Columns(columns =>
                                   {
                                       columns.Bound(e => e.PersonFirstName).Width(230).Title("First Name");
                                       columns.Bound(e => e.PersonLastName).Width(230).Title("Last Name");
                                       columns.Bound(e => e.DOB).Width(120).Title("D.O.B");
                                       columns.Bound(e => e.Gender).Width(100).Title("Gender").EditorTemplateName("GenderDropDown");
                                       columns.Bound(e => e.SSN).Width(230).Title("SSN");
                                       columns.Command(command =>
                                                           {
                                                               if (ClaimsAuthorize.CheckAccess(Constants.Actions.Delete, Resources.Employee))
                                                               {
                                                                   command.Destroy();
                                                               }
                                                               if (ClaimsAuthorize.CheckAccess(Constants.Actions.Update, Resources.Employee))
                                                               {
                                                                   command.Edit();
                                                                   command.Custom("ViewDetails").Click("EmployeeDetails");
                                                               }
                                                           }).Width(260).Title("Commands");
                                   })
                      .Editable(editable => editable.Mode(GridEditMode.InLine))
                      .DataSource(datasource => datasource
                                                    .Ajax()
                                                    .ServerOperation(false)
                                                    .Model(model => model.Id(e => e.Id))
                                                    .Events(events => events.Error("error_handler"))
                                                    .Create(create => create.Action("CreateEmployee", "EmployeeAjax"))
                                                    .Read(read => read.Action("ReadEmployees", "EmployeeAjax"))
                                                    .Update(update => update.Action("EditEmployee", "EmployeeAjax"))
                                                    .Destroy(delete => delete.Action("DeleteEmployee", "EmployeeAjax"))
                      )
                      .ToolBar(tb =>
                                   {
                                       if (ClaimsAuthorize.CheckAccess(Constants.Actions.Create, Resources.Employee))
                                       {
                                           tb.Create();
                                       }
                                   })
                           .Pageable()
                      .Sortable()
                      .Scrollable()
                      .Filterable()
                      .Resizable(c => c.Columns(true))
                      .Reorderable(c => c.Columns(true))
                      .ColumnMenu()
                      .Groupable())


And the GendorDropDown partial view looks like:


    @(Html.Kendo().DropDownListFor(m => m)
      .Name("Gender")
      .DataTextField("Text")
      .DataValueField("Value")
      .BindTo(new List<SelectListItem>
                  {
                      new SelectListItem {Text = "Male", Value = "M"},
                      new SelectListItem {Text = "Female", Value = "F"}
                  }))


However if I try to setup a Server Bound View using the same template it fails to render the dropdown at all. The column appears but with a value but this disappears completely when attempting to edit the line.


The code for the failing view is below:


    @(Html.Kendo().Grid(Model)
                      .Name("EmployeesGrid")
                      .Columns(columns =>
                                   {
                                       columns.Bound(e => e.PersonFirstName).Width(230).Title("First Name");
                                       columns.Bound(e => e.PersonLastName).Width(230).Title("Last Name");
                                       columns.Bound(e => e.DOB).Width(120).Title("D.O.B");
                                       columns.Bound(e => e.Gender).Width(100).Title("Gender").EditorTemplateName("GenderDropDown");
                                       //columns.ForeignKey(e => e.Gender, new List<SelectListItem>
                                       //                                      {
                                       //                                          new SelectListItem {Text = "Male", Value = "M"},
                                       //                                          new SelectListItem {Text = "Female", Value = "F"}
                                       //                                      }, "Value", "Text").Width(100).Title("Gender");
                                       columns.Bound(e => e.SSN).Width(230).Title("SSN");
                                       columns.Command(command =>
                                                           {
                                                               if (ClaimsAuthorize.CheckAccess(Constants.Actions.Delete, Resources.Employee))
                                                               {
                                                                   command.Destroy();
                                                               }
                                                               if (ClaimsAuthorize.CheckAccess(Constants.Actions.Update, Resources.Employee))
                                                               {
                                                                   command.Edit();
                                                                   command.Custom("ViewDetails").Action("Details", "Employee").Text("Details");
                                                               }
                                                           }).Width(260).Title("Commands");
                                   })
                      .Editable(editable => editable.Mode(GridEditMode.InCell))
                      .DataSource(datasource => datasource
                      .Server()
                      
                              .Model(model => { model.Id(e => e.Id);
                                                  model.Field(e => e.DOB).DefaultValue(null);
                              })
                      .Create(create => create.Action("Create","Employee"))
                      .Read(read => read.Action("Index","Employee"))
                      .Update(update => update.Action("Edit","Employee"))
                      .Destroy(delete => delete.Action("Delete","Employee"))
                      )
                      .ToolBar(tb =>
                                   {
                                       if (ClaimsAuthorize.CheckAccess(Constants.Actions.Create, Resources.Employee))
                                       {
                                           tb.Create();
                                       }
                                   })
                      .Pageable()
                      .Sortable()
                      .Scrollable()
                      .Filterable()
                      .Resizable(c => c.Columns(true))
                      .Reorderable(c => c.Columns(true))
                      .ColumnMenu()
                      .Groupable())


It unclear to me reading the documentation to see if this is even supported or whether the partial view for the template needs to look different. Any help with this would be greatly appreciated and sorry for the masses of cut and paste code.
Atanas Korchev
Telerik team
 answered on 24 Dec 2012
1 answer
139 views
Hello again,
In the local examples for kendo ui with mvc there is no example with popup editing,and online is only in html/jquery.
is there a example you can send me for mvc,because as i saw,in the grid for Editable parameter there is a value for Mode,Popup and i would like to know how can i use it.

Thank you
Dimo
Telerik team
 answered on 21 Dec 2012
2 answers
562 views
Hello,

I was wondering how strict the 30 day trial period is for MVC?  Is it in anyway enforced by the included DLL to prevent use after 30 days?

I only ask, as I set it up in my dev environment earlier this week, got it working in one of my projects, but now I won't have time to work on any of my projects until January.

As I won't be using it over the Christmas period, it seems I won't get to actually trial this product if it prevents execution after 30 days.  (30 days seems a bit odd for a development library to be honest anyway.. couldn't you just limit it to only work on localhost, and not via any other domain / remote client ip?).


Thanks,
Shannon.
Shannon
Top achievements
Rank 1
 answered on 21 Dec 2012
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
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
ColorPicker
DateRangePicker
Security
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
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
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
SegmentedControl
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
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?