Telerik Forums
UI for ASP.NET MVC Forum
3 answers
459 views
The edit functionality of the grid is not working out for me... 
I have come up with an ajax action link but would like to style it the same as the edit button without it firing the edit. 

so far I have this but it produces one icon in the button and one outside of the button and there is no text, How can I recreate the edit button without it firing the default edit command of the grid?

<a class='k-button k-button-icontext' data-ajax='true' data-ajax-mode='replace' data-ajax-method='Get' data-ajax-update='\\#editorform'  href='/FallsAssessment/Edit?EventID=#=EventID #' data-ajax-success='showModal'><span class='k-icon k-i-pencil'/>Edit</a>
Thanks 

David 
David
Top achievements
Rank 1
 answered on 17 Jul 2013
8 answers
1.5K+ views
Hi,

Just downloaded 2013.1.319.340 and am receiving the following error when using the menu:

"The method or operation is not implemented".

(StackTrace)
[NotImplementedException: The method or operation is not implemented.]
   System.Web.HttpRequestBase.get_HttpMethod() +29
   System.Web.Routing.<>c__DisplayClass3.<Match>b__0(String method) +25
   System.Linq.Enumerable.Any(IEnumerable`1 source, Func`2 predicate) +146
   System.Web.Routing.HttpMethodConstraint.Match(HttpContextBase httpContext, Route route, String parameterName, RouteValueDictionary values, RouteDirection routeDirection) +164
   System.Web.Routing.HttpMethodConstraint.System.Web.Routing.IRouteConstraint.Match(HttpContextBase httpContext, Route route, String parameterName, RouteValueDictionary values, RouteDirection routeDirection) +22
   System.Web.Routing.Route.ProcessConstraint(HttpContextBase httpContext, Object constraint, String parameterName, RouteValueDictionary values, RouteDirection routeDirection) +56
   System.Web.Routing.Route.ProcessConstraints(HttpContextBase httpContext, RouteValueDictionary values, RouteDirection routeDirection) +100
   System.Web.Routing.Route.GetRouteData(HttpContextBase httpContext) +178
   System.Web.Routing.RouteCollection.GetRouteData(HttpContextBase httpContext) +233
   Kendo.Mvc.Infrastructure.Implementation.RouteDataCache.RouteDataFactory(String url) +59
   Kendo.Mvc.Infrastructure.Implementation.<GetRouteData>c__AnonStorey1B.<>m__26() +13
   Kendo.Mvc.Infrastructure.Implementation.NoCache.Get(String key, Func`1 defaultValueFactory) +11
   Kendo.Mvc.Infrastructure.Implementation.RouteDataCache.GetRouteData(String key, String url) +98
   Kendo.Mvc.Infrastructure.Implementation.AuthorizationContextCache.GetAuthorizationContext(RequestContext request, String controllerName, String actionName, RouteValueDictionary routeValues) +362
   Kendo.Mvc.Infrastructure.Implementation.ControllerAuthorization.IsAccessibleToUser(RequestContext requestContext, String controllerName, String actionName, RouteValueDictionary routeValues) +55
   Kendo.Mvc.Infrastructure.Implementation.NavigationItemAuthorization.IsAccessibleToUser(RequestContext requestContext, INavigatable navigationItem) +186
   Kendo.Mvc.UI.NavigatableExtensions.IsAccessible(INavigatable item, INavigationItemAuthorization authorization, ViewContext viewContext) +29
   Kendo.Mvc.UI.NavigationItemContainerExtensions.WriteItem(TItem item, TComponent component, IHtmlNode parentTag, INavigationComponentHtmlBuilder`1 builder) +197
   Kendo.Mvc.UI.<WriteHtml>c__AnonStorey76.<>m__247(MenuItem item) +24


(rest omitted for brevity)

The code is as follows:
@(Html.Kendo().Menu()
 .Name("mn-case")
 .Items(items =>
 {
items.Add().Text("Dashboard").Action("Index", "Dashboard", new { caseId = caseId, area="Case" });
}))
The route is defined as follows:
context.MapRoute("CaseIndex",
               "Case/{caseId}/{controller}",
               new { action = "Index"},
               new RouteValueDictionary { { "httpMethod", new HttpMethodConstraint("GET") }}
               );
This did not happen in previous versions and the workaround is to use Url.Action as follows:
items.Add().Text("Dashboard").Url(@Url.Action("Index", "Dashboard", new { caseId = caseId, area="Case" }));
I have many projects that use the menu and do not want to have to change them all.  Is this a problem on my end or is it Kendo?

Thank you,
David Adams

xclirion
Top achievements
Rank 1
 answered on 17 Jul 2013
2 answers
164 views
Hello,

I'm trying to migrate a panel bar from MVC extensions to Kendo. When the Panel bar loads, I expand specific items via a initialization script.
What I find is that if I call

var panelbar = $("#PanelBar").data("kendoPanelBar");

in $(document).ready() as adviced as in

http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/migration/widgets/panelbar, I get a null object.
This call however succeeds to get the correct object if called later.
Since, onLoad() is removed in Kendo, is there any other way I can initialize my Panelbar ?

Kind Regards

Achilles
Achilles
Top achievements
Rank 1
 answered on 17 Jul 2013
1 answer
166 views
I have a grid with a change event. When the change event is invoked a redirect takes place towards another page.
I want to add a column with a checkbox which does not cause the change event to be fired. The other columns must still cause the change event to be fired.
How can this be done?

The same is valid for the listview. I have a listview with a client template and I need to show a checkbox which doesn't cause the change event to be fired.
Dimo
Telerik team
 answered on 17 Jul 2013
1 answer
405 views
Hi,
I couldn't find any example of how to attach datasource events such as requestStart, requestEnd, or error using the Mvc Grid Helper.  Can it be done?
Dimiter Madjarov
Telerik team
 answered on 17 Jul 2013
1 answer
2.0K+ views
Hi,

I'm almost done with the code from the subject. The tree expands already to the given ID, but unfortunately it does not select the node given by ID

Edit: Just to clarify, because I read a few threads regarding this issue - I don't get any error messages nor do I get 'undefined' for any variables. The node just doesn't get selected.

function expandAndSelectNode(id, treeViewName) {
    // get the Kendo TreeView widget by it's ID given by treeviewName
    var treeView = $(treeViewName).data('kendoTreeView');
     
    // find node with data-id = id
    var item = $(treeViewName).find("li[data-id='" + id + "']").find(".k-in");
     
    // expand all parent nodes
    $(item).parentsUntil('.k-treeview').filter('.k-item').each(
                function (index, element) {
                    $(treeViewName).data('kendoTreeView').expand($(this));
                }
            );
     
    // get DataSourceItem by given id
    var nodeDataItem = treeView.dataSource.get(id);
 
    //get node within treeview widget by uid
    var node = treeView.findByUid(nodeDataItem.uid);

    $(treeView).select(node);
    //treeView.select(".k-item:last");
}

I also tried $(treeView).select(item), since it should already point to the <span> item I want to select anyway. This didn't work.
Then I tried tried $(treeView).select(item.closest('.k-item')), since it points to the parent <li> element, but this didn't work either.
 The uncommented line (treeView.select(".k-item:last")) was just for testing and works.

I'm a little bit stuck and glad about any hints.

Daniel
Telerik team
 answered on 16 Jul 2013
1 answer
549 views
Hi,

I'am trying to create a dropdownlist with a guid as id : 

Dim dropDownListFor = _htmlHelper.Kendo().DropDownListFor(Of Integer)(_expression) _
                                                     .BindTo(New SelectList(_collectionValeur, "Id", "Name")) _
                                                     .HtmlAttributes(_attributsHtml)

Id is a Guid 
Name is a String

But I'm having the following error :

System.InvalidOperationException: Templates can be used only with field access, property access, single dimension array index, or single-parameter custom indexer expressions.

Any help please ?
Daniel
Telerik team
 answered on 15 Jul 2013
1 answer
125 views
I have a grid for a model Departments. Departments has a foreign key field ParentDepartmentKey. The foreign key field correctly generates a dropdown list with Departmens listed. However, if you add a new department, it is added to the grid, but the dropdown in the foreign key field is not updated and does not update.

Is it possible to have the foreign key field update when an item is added to the grid?
Vladimir Iliev
Telerik team
 answered on 15 Jul 2013
1 answer
1.7K+ views
In my attempts to right align, and apply a {0:N} format to the Sum on a ClientFooterTemplate  in MVC, I've got this far, but the format is not applied:

columns.Bound(e => e.BookValue).Title("Book Value ($)")
        .ClientFooterTemplate("<div class=aright>#=sum#</div>").Format("{0:N}")
It's right aligned now, but still the sum is showing 7 decimal places.

Should I be doing anything to the Aggregate instead of in the ClientFooterTemplate   ?                    

Ideas?           
Kiril Nikolov
Telerik team
 answered on 15 Jul 2013
4 answers
311 views
Hi,

I'm having an issue with the Kendo Grid, using the MVC extensions.

I have a foreign key column defined which displays perfectly when the grid is shown.  However, on edit, the dropdown (provided by a copy of the GridForeignKey.cshtml editor template) does not select the correct value for the record.  This is the case whether we're using InCell, InLine or Popup editing.

To clarify, the dropdown shows all the correct available values, but the default is selected instead of the value in the record.

ViewModels:
public class BranchesViewModel
{
    public IQueryable<BranchViewModel> Branches { get; set; }
    public IEnumerable<RegionViewModel> Regions { get; set; }
}
 
public class BranchViewModel
{
    [Editable(false, AllowInitialValue = true)]
    [Required]
    [Display(Name="Id")]
    [HiddenInput(DisplayValue = false)]
    public int BranchId { get; set; }
 
    [Display(Name="GL Code", Order=2)]
    [Required]
    public string GLCode { get; set; }
 
    [Display(Name="Region", Order=3)]
    [Required]
    [UIHint("RegionForeignKey")]
    public int RegionId { get; set; }
 
    [Display(Name="Branch Name", Order=1)]
    [Required]
    public string BranchName { get; set; }
}
 
public class RegionViewModel
{
    public int RegionId { get; set; }
    public string RegionName { get; set; }
}

Index View:
<h2>Branches</h2>
 
@(Html.Kendo().Grid<BranchViewModel>()
      .Name("Branch")
      .Columns(col =>
                   {
                       col.Bound(m => m.BranchName);
                       col.Bound(m => m.GLCode).Width(200);
                       col.ForeignKey(m => m.RegionId, Model.Regions, "RegionId", "RegionName").Width(180);
                       col.Command(cmd => { cmd.Edit(); cmd.Destroy(); }).Width(180);
                   })
      .ToolBar(toolBar => toolBar.Create().Text("New Branch"))
      .Editable(edit =>
                    {
                        edit.Mode(GridEditMode.InLine);
                        edit.DisplayDeleteConfirmation(true);
                    })
      .Sortable()
      .DataSource(dataSource => dataSource
        .Ajax()
        .Batch(true)
        .ServerOperation(false)
        .Events(events => events.Error("errorHandler"))
        .Model(model => model.Id(b => b.BranchId))
        .Read(read => read.Action("Branch_Read", "Branch"))
        .Create(create => create.Action("Branch_Create", "Branch"))
        .Update(update => update.Action("Branch_Update", "Branch"))       
        .Destroy(destroy => destroy.Action("Branch_Delete", "Branch"))
    )
)

RegionForeignKey Partial (in Views/Branch/EditorTemplates/):
Note: this is what I'm using now, however if I revert to the GridForeignKey editor template the behaviour is the same.
@model int
 
@(Html.Kendo().DropDownListFor(m => m)
    .BindTo((SelectList)ViewData[ViewData.TemplateInfo.GetFullHtmlFieldName("") + "_Data"])
)

Controller Actions:
public ActionResult Index()
{
    var model = new BranchesViewModel
                    {
                        Branches = _branchRepository.Get().Select(
                            b => new BranchViewModel
                                     {
                                         BranchId = b.Id,
                                         GLCode = b.GLCode,
                                         BranchName = b.BranchName,
                                         RegionId = b.RegionId
                                     }
                        ),
                        Regions = _regionRepository.Get().Select(
                            r => new RegionViewModel
                                     {
                                         RegionId = r.Id,
                                         RegionName = r.RegionName
                                     }
                        ).ToList()
                    };
     
    return View(model);
}
 
 
// Ajax for branches
public ActionResult Branch_Read([DataSourceRequest] DataSourceRequest request)
{
    var branches = _branchRepository.Get().Select(
        b => new BranchViewModel
                 {
                     BranchId = b.Id,
                     GLCode = b.GLCode,
                     BranchName = b.BranchName,
                     RegionId = b.RegionId
                 }
        );
    return Json(branches.ToDataSourceResult(request));
}

I've scoured a number of other forum posts and haven't been able to find an answer.  Any help you could give would be very welcome.
Vladimir Iliev
Telerik team
 answered on 15 Jul 2013
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
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
SmartPasteButton
PromptBox
SegmentedControl
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?