Telerik Forums
UI for ASP.NET MVC Forum
1 answer
606 views
Hi all

When I load the page with the following grid, the browser show me this message "Error! The requested URL returned 500 - Internal Server Error"
Could anybody help me please?

That's my code:

(IndexRechte.cshtml)
@(Html.Telerik().Grid<GruppeFunktion>()
   .Name("Grid")
   .DataKeys(keys =>
       {
           keys.Add(o => o.GruppeFunktionID);
       })
   .ToolBar(commands => { commands.SubmitChanges(); })
   .DataBinding(dataBinding =>
           dataBinding.Ajax()
               .Select("_IndexRechte", "Rechte")
               .Update("_SaveBatchEditing", "Rechte")
   )
   .Columns(columns =>
   {
       columns.Bound(o => o.GruppeFunktionID);
       columns.Bound(o => o.visible)
           .ClientTemplate("<#=visible? 'ja' : 'nein' #>")
           .Title("K")
           .Width(12);
   })
 
   .ClientEvents(events => events
       .OnDataBinding("Grid_onDataBinding")
       .OnError("Grid_onError"))
       .Editable(editing => editing.Mode(GridEditMode.InCell))
       .Scrollable(scrolling => scrolling.Enabled(false).Height("auto")) // ohne Scrolling zerfällt die Tabelle, wenn sie zu breit ist
       .TableHtmlAttributes(new { style = "table-layout = fixed" })
       .Resizable(resizing => resizing.Columns(true))
       .Sortable()
       .Filterable()
       .Groupable()
       .Pageable(paging =>
           paging
               .PageSize(ViewBag.PageSize)
               .Style(ViewBag.PageStyle)
               .Position(GridPagerPosition.Bottom)
        )
   )

And that's the Controller:

[GridAction] 
       public ActionResult _IndexRechte()
       {
           List<GruppeFunktion> gruppeFunktion;
 
           gruppeFunktion = (List<GruppeFunktion>)Session["gruppeFunktion"];
 
           // vorbereitete Geschäftsliste anzeigen
           return View(new GridModel<GruppeFunktion> { Data = gruppeFunktion });
       }
 
       public ViewResult IndexRechte(Guid gruppeID)
       {
           // PageSize
           ViewBag.PageSize = PageSizeFunktionliste;
 
           List<GruppeFunktion> gruppeFunktion = (from ObjGF in this.db.GruppeFunktion
                                                  where ObjGF.GruppeID == gruppeID
                                                  select ObjGF).ToList();
           Session["gruppeFunktion"] = gruppeFunktion;
 
           if (gruppeFunktion.ToList().Count > PageSizeFunktionliste)
           {
               ViewBag.PageStyle = GridPagerStyles.NextPreviousAndNumeric;
           }
           else
           {
               ViewBag.PageStyle = GridPagerStyles.Status;
           }
 
           return View();
       }

Thank's a lot!

Marco
Bill
Top achievements
Rank 1
 answered on 02 Jul 2013
2 answers
185 views
I created a custom popup editor for my grid.  I have two string fields, both defined with [StringLength(20)] in the model.  In the custom popup editor template I use EditorFor to display an editor for both fields.  One gets a standard text input as expected.  One gets the WYSIWYG editor.  (Screenshot attached) Color me confused.  Any ideas?

The two fields I'm referring to in the template below are PowerNumber and CaseNumber.  

The model definitions are:
        [Required]
        [StringLength(20)]
        [Display(Name="Power")]
        public string PowerNumber { get; set; }

        [StringLength(20)]
        [Display(Name="Case #")]
        public string CaseNumber {get; set;}

The editor template:

@model KendoMVC4.Models.Power
@Html.HiddenFor(model => model.ID)
<div class="editor-label">
    @Html.LabelFor(model => model.PowerNumber)
</div>
<div class="editor-field">
    @Html.EditorFor(model => model.PowerNumber)
    @Html.ValidationMessageFor(model => model.PowerNumber)
</div>
<br />
<div class="editor-label">
    @Html.LabelFor(model => model.Posted)
</div>
<div class="editor-field">
    @Html.Kendo().DatePickerFor(model => model.Posted)
    @Html.ValidationMessageFor(model => model.Posted)
</div>
<br />
<div class="editor-label">
    @Html.LabelFor(model => model.Forfeited)
</div>
<div class="editor-field">
    @Html.Kendo().DatePickerFor(model => model.Forfeited)
    @Html.ValidationMessageFor(model => model.Forfeited)
</div>
<br />
<div class="editor-label">
    @Html.LabelFor(model => model.Discharged)
</div>
<div class="editor-field">
    @Html.Kendo().DatePickerFor(model => model.Discharged)
    @Html.ValidationMessageFor(model => model.Discharged)
</div>
<br />
<div class="editor-label">
    @Html.LabelFor(model => model.CaseNumber)
</div>
<div class="editor-field">
    @Html.Kendo().EditorFor(model => model.CaseNumber)
    @Html.ValidationMessageFor(model => model.CaseNumber)
</div>
<br />
<div class="editor-label">
    @Html.LabelFor(model => model.State)
</div>
<div class="editor-field">
    @(Html.Kendo().DropDownListFor(model => model.State)
            .Name("State")
            .OptionLabel("Select State")
            .DataTextField("Text")
            .DataValueField("Value")
            .Items(items =>
                {
                    items.Add().Text("Alaska").Value("AK");
                    items.Add().Text("Hawaii").Value("HI");
                    items.Add().Text("New York").Value("NY");
                    items.Add().Text("Texas").Value("TX");
                })
                )
</div>
<br />
Frederick
Top achievements
Rank 1
 answered on 02 Jul 2013
1 answer
117 views
I followed the instructions here and successfully created a custom command column which displays some text in a popup window.  The next step in what I'd like to do is to have the user able to edit something  on the window shown by that custom command and update the datasource.  How can this be accomplished?

In other words, how can I add, for example, a DatePickerFor a particular field in the model and have a button click send that data back for update?  The model being used is a list of items so it would have to be a DatePicker for the current item in the list.
Daniel
Telerik team
 answered on 02 Jul 2013
1 answer
323 views
Hi, 

I have a column chart which does not show the legend even though I have set legend.Visible to true. If I uncomment the .Group line commented in the code below, then the legend starts showing, but unfortunately it displays the default colors rather than those I have customised with m => m.UiColor
                        
@(Html.Kendo().Chart<WorkItemStatusSummary>()
                      .Name("Chart")
                      .Legend(legend => legend
                          .Visible(true)
                          .Position(ChartLegendPosition.Bottom))
                      .DataSource(ds => ds
                        .Read(read => read
                            .Action("DummyAction", "DummyController")
                            .Data("ChartAdditionalFilterData"))
                        //.Group(g => g.Add(m => m.Status))
                      )
                      .Series(series => series.Column(m => m.Count, m => m.UiColor).Name(""))
                      .CategoryAxis(axis => axis
                                                .Categories(m => m.Status)
                      )
   )
Iliana Dyankova
Telerik team
 answered on 02 Jul 2013
0 answers
163 views
I recently updated several nuget packages in my MVC4 solution. After the update none of the kendo styles or js files were being found. I narrowed it down to the bundling, and identified it was an update to "Microsoft ASP.NET Web Optimization Framework" 1.1.0

The release notes (http://aspnetoptimization.codeplex.com/releases/view/101096) has a section at the bottom that explains why.

I thought of 3 potential solutions:
  1. Change the IgnoreList to be applied to the new directory filters instead (I didn't try this one)
  2. Include the kendo css and js files without using wildcards (tried this one and it works)
  3. Include the non-minified versions of the files, taken from the 'src' folder, in my solution (tried this one and it works)

I've ended up using option 3 as it seems to work best with the intention of how the MV4C bundling should work (non-minified used in debug so can debug into kendo code, and then minified version used in release).

I'm mainly posting to help anyone else who hits this problem, but if anyone has any suggestion why option 3 is not a good option I'd like to hear.

Also Kendo should probably update the documentation as the current IgnoreList approach no longer works.

Alex
Top achievements
Rank 1
 asked on 02 Jul 2013
5 answers
625 views
I have a DropDownList that, depending on another value, has anywhere from 5 to 15 values in it and there are about 20-25 total possible values.
It seems a bit ridiculous to go back to the server to get the proper data.
What I would like to do is render ALL of the items to the browser (as an array or something?) and do the filtering on the browser in javascript.
Has anyone done anything like this?  I can't find any examples of cascading DropDownLists that don't have ServerFiltering turned on.
jasonxz
Top achievements
Rank 1
 answered on 01 Jul 2013
1 answer
109 views
Hi,

I'm trying to create a menu in my MVC 4 _Layout.cshtml file.

I started from the example and I hacked it up to show the structure I want.  The problem is that when I use the syntax:
children.Add().Text("Application Home").Action("Index", "Home");

Sometimes the menu item is placed correctly with the action wired up.  Other times the action appears to be causing some kind of error, (page compiles fine), but the item is not shown.  If I remove the Action method, the 
item shows up where it's supposed to.

I've attached the entire menu code.  Can someone please help?

001.@(Html.Kendo().Menu()
002.          .HighlightPath(true)
003.          .Name("Menu")
004.          .Items(items =>
005.          {
006.            items.Add()
007.                .Text("Home")
008.                .Items(children =>
009.                {
010.                    children.Add().Text("Website Home");
011.                    children.Add().Text("Application Home").Action("Index", "Home");
012.                });                                     
013. 
014.              items.Add()
015.                  .Text("Company")
016.                  .Items(children =>
017.                   {
018.                       children.Add().Text("Events")
019.                               .Items(innerChildren =>
020.                               {
021.                                   innerChildren.Add().Text("List");
022.                                   //.Action("Index", "CompanyEvents");
023.                                   innerChildren.Add().Text("Calendar View");
024.                                   //.Action("Calendar", "CompanyEvents");
025.                               });
026. 
027.                       children.Add().Text("Departments");
028.                           //.Action("Index", "Department");
029. 
030. 
031.                       children.Add().Text("Configure")
032.                              .Items(innerChildren =>
033.                              {
034.                                  innerChildren.Add().Text("Benefit Year");
035.                                      //.Action("Index", "BenefitYear");
036.                                  innerChildren.Add().Text("Employee Types").Action("Index", "EmployeeType");
037.                                  innerChildren.Add().Text("Holidays").Action("Index", "Holiday");
038.                                  innerChildren.Add().Text("Job Codes").Action("Index", "JobCode");
039.                                  innerChildren.Add().Text("PTO Request Status Codes").Action("Index", "RequestStatusCode");
040.                                  innerChildren.Add().Text("PTO Acrual").Action("Index", "PTOAcrual");
041.                              });
042.                        
043.                    });
044.               
045.                    items.Add()
046.                        .Text("Employee")
047.                        .Items(children =>
048.                        {
049.                            children.Add().Text("Employee Search");
050.                                //.Action("Index", "Employee");
051.                            children.Add().Text("Employee Grid");
052.                                //.Action("IndexGrid", "Employee");
053. 
054.                            children.Add().Text("PTO Request")
055.                                    .Items(innerChildren =>
056.                                    {
057.                                        innerChildren.Add().Text("List").Action("Index", "PTORequest");
058.                                        innerChildren.Add().Text("New PTO Request").Action("Create", "PTORequest");
059.                                    });
060. 
061.                            children.Add().Text("Edit Personal Data").Action("Edit", "Employee", new { id = EmpId });
062.                            children.Add().Text("Employee Profile")
063.                                    .Items(innerChildren =>
064.                                    {
065.                                        innerChildren.Add().Text("List").Action("Index", "EmployeeProfile");
066.                                        //innerChildren.Add().Text("Edit my Profile").Action("Edit", "EmployeeProfile", new { id = EmpProfileId });
067.                                        innerChildren.Add().Text("Edit my Profile").Action("Edit", "EmployeeProfile");
068.                                    });
069. 
070.                            children.Add().Text("Sanction")
071.                                    .Items(innerChildren =>
072.                                    {
073.                                        innerChildren.Add().Text("List").Action("Index", "Sanction");
074.                                        innerChildren.Add().Text("New Sanction").Action("Create", "Sanction");
075.                                    });
076. 
077.                            children.Add().Text("Attendance Log")
078.                                    .Items(innerChildren =>
079.                                    {
080.                                        innerChildren.Add().Text("List").Action("Index", "AttendanceLog");
081.                                        innerChildren.Add().Text("New Attendance Log").Action("Create", "AttendanceLog");
082.                                    });
083. 
084.                            children.Add().Text("Timesheet")
085.                                    .Items(innerChildren =>
086.                                    {
087.                                        innerChildren.Add().Text("List").Action("Index", "TimeSheet");
088.                                        innerChildren.Add().Text("List (Grid)").Action("IndexGrid", "TimeSheet");
089.                                        innerChildren.Add().Text("New Timesheet").Action("Create", "Timesheet");
090.                                    });
091. 
092.                        });
093. 
094. 
095.                    items.Add()
096.                        .Text("Admin").HtmlAttributes(new { id="admin"})
097.                        .Items(children =>
098.                        {
099.                            children.Add().Text("Company").Action("Index", "Company");
100.                            children.Add().Text("Subscription Level").Action("Index", "SubscriptionLevel");
101.                            children.Add().Text("Subscription Limits").Action("Index", "SubscriptionLimit");
102.                            children.Add().Text("PTO Pool Type").Action("Index", "PTOPoolType");
103.                            children.Add().Text("Absence Code").Action("Index", "AbscenceCode");
104.                            children.Add().Text("Timesheet Status Codes").Action("Index", "TimesheetStatusCode");
105.                            children.Add().Text("Activity Log").Action("Index", "ActivityLog");
106.                            children.Add().Text("Release History").Action("Index", "ReleaseHistory");
107.                            children.Add().Text("Report List").Action("Index", "Report");
108.                            children.Add().Text("Suggestion List").Action("Index", "UserSuggestion");
109.                            children.Add().Text("Create Employee w/o User").Action("Create", "Employee");
110.                        }).Enabled(false);
111.               
112.              //items.Add().Text("About");
113.              //items.Add().Text("Contact");
114.          })
115.        )

Bill
Top achievements
Rank 1
 answered on 01 Jul 2013
4 answers
102 views
I have a grid setup with Ajax loading/editing, etc.  Paging works fine in Chrome and Firefox but in IE10 (10.0.9200.16618) I have to turn on compatibility mode to get it to work.  Without compatibility mode, paging options still show up but grid is showing all records instead of limiting to number of records set with .PageSize setting on grid. After turning on compatibility mode, the paging works but I get errors such as the attached when changing pages or opening the popup editor.

Steps to reproduce:

Paging
  1. Change page and get the first error (attachment named PagingError.png)

Editing
  1. Click the edit button in the grid.
  2. First get the same error as above
  3. Click No to debug prompt
  4. Get second error (attachment named CouldNotContinue.png)
  5. Click No to debug prompt
  6. Click edit button again
  7. Popup editor comes up but no datepicker for the date fields and date field shows "Wed Feb 13 00:00:00 CST 2013"

Any suggestions/ideas on why this is and how to correct it?
Frederick
Top achievements
Rank 1
 answered on 01 Jul 2013
2 answers
293 views
I have a grid that I toggle the visibility of certain columns on and off in certain user situations.

Hiding the columns works fine, but when I add a row to the grid, the columns I hid become visible again as soon as I click the grid's "Add" button.

I'm not sure if this is desired or not, but I'd appreciate a workaround if it's not considered a bug.  Thanks!

Script that hides the columns:
function SetItemGridView(isManual) {
    var itemGrid = $("#ItemGrid").data("kendoGrid");
 
    if (isManual) {
        itemGrid.showColumn("MyTestCol");
    } else {
        itemGrid.hideColumn("MyTestCol");
    }
}
Grid Databound function that calls SetItemGridView:
function ConfigureItemGrid(e) {
    SetItemGridView($("#IsManual").length > 0 ? $("#IsManual").is(":checked") : true);
}

Grid code (simplified for brevity):
@(Html.Kendo().Grid(Model)
    .Name("ItemGrid")
    .Columns(columns =>
    {
        columns.Bound(i => i.MyTestCol).Width(100);
        columns.Command(command =>
        {
            command.Destroy();
        }).Width(60);
    })
    .Events(e =>
    {
        e.DataBound("ConfigureItemGrid");
        e.Edit("onItemGridEdit");
    })
    .ToolBar(toolbar =>
    {
        toolbar.Create();
    })
    .Editable(editable =>
    {
        editable.Mode(GridEditMode.InCell).CreateAt(GridInsertRowPosition.Bottom);
    })
    .Navigatable(navigatable => navigatable.Enabled(true))
    .DataSource(dataSource => dataSource
        .Ajax()
        .Batch(true)
        .ServerOperation(false)
        .Model(model =>
        {
            model.Id(i => i.ItemModelID);
        })
        .Create(create => create.Action("CreateProducts", "ItemGrid"))
        .Read(read => read.Action("GetProducts", "ItemGrid"))
        .Update(update => update.Action("UpdateProducts", "ItemGrid"))
        .Destroy(destroy => destroy.Action("DeleteProducts", "ItemGrid"))
    )
)
Jark Monster
Top achievements
Rank 1
 answered on 01 Jul 2013
1 answer
122 views
My popup editor contains a dropdown list which fires an onchange event which populates the form with additional custom fields specific to the dropdown value. When the form is submitted, these custom fields do not show up in the FormCollection.

I am guessing the problem lies in the fact that these dynamically added fields are somehow not initialized properly?
Daniel
Telerik team
 answered on 01 Jul 2013
Narrow your results
Selected tags
Tags
+? 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?