Telerik Forums
UI for ASP.NET MVC Forum
2 answers
134 views

 

If I have a treelist or grid with "popup" editing and an autosync datasource, how can I have the popup editor appear immediately for the new record?

It seems that with autosync, the create action is called immediately and no popup editor appears.

Ideally I would like the popup before going to the create action (same as without autosync).

It would be acceptable for the popup to appear after calling the create action on the server, so that it is editing a record filled with defaults.

Rosen
Telerik team
 answered on 09 Nov 2015
1 answer
153 views

Hi,

I have a chart which shows 3 lines. My client asks whether it is possible to have a background color between the lowest and highest line inside the area.
See the attachment for my example. The red lines mark the area which should be a light, gray color.

Any ideas?

Best,
Daniel

 
T. Tsonev
Telerik team
 answered on 09 Nov 2015
1 answer
81 views

 I have a combobox as a wrapper in MVC within a cshtml page.  I need to modify the read.URL to build my url and supply the appropriate search criteria.  I found a similar question and provided a link below to the answer, however this is using pure javascript and doesn't really fit my situation. How do i create a custom function in the .Read of the datasource so that i can build my url but do it with the MVC Wrapper?  Also is there more detailed documentation with comments etc the api just shows you a very slim example for a feature and doesn't really document what is going on.  Any help would be appreciated.

 

 Link to answer that answers my exact question but i need the answer for the MVC Wrapper not javascript:

http://www.telerik.com/forums/how-do-i-specify-a-variable-in-the-middle-of-data-source-read#BPwmciunhUyELOSvZKBqIQ

Georgi Krustev
Telerik team
 answered on 09 Nov 2015
7 answers
207 views
Hi All,

Does PivotGrid supports custom client-side filtering?
I see PivotConfigurator has powerful filtering functionality however I need to make my own filters applied to the Pivot Data.
Is there any API I can use to create my own filtering drop-downs or default filtering criteria.

I guess PivotGrid and PivotConfigurator has this functionality, but is it available for client scripts?

Thank you,
Andrei

P.S. I'm creating a POC to evaluate different vendors of pivot controls for ASP.Net MVC (Webforms is also an option).
Georgi Krustev
Telerik team
 answered on 09 Nov 2015
7 answers
2.0K+ views
I am trying to do some filtering on a grid, and I want to filter where a field is not equal to null.  I have the following javascript:
var grid = $("#Grid").data("kendoGrid");
$filter = new Array();
if (contact == true) {
   $filter.push({ field: "ContactDate", operator: "neq", value: null });
grid.dataSource.filter($filter);

This doesn't work though. I get a 500 error: System.ArgumentException: Invalid property or field - 'null' for type: 'MyView'.  How do I filter on my date field not being null?
Vladimir
Top achievements
Rank 2
 answered on 08 Nov 2015
1 answer
79 views

The master grid is not recognized as a master grid.

Detail Template

<script id="inviteehistorytemplate" type="text/x-kendo-template">
    @(Html.Kendo().Grid<BusinessEntities.ChangeHistory>()
        .Name("grid_#=EventID#") // make sure the Name is unuque
        .Columns(c =>
        {
            c.Bound(h => h.FieldName);
            c.Bound(h => h.NewValue);
            c.Bound(h => h.OldValue);
            c.Bound(h => h.UpdatedBy);
            c.Bound(h => h.UpdatedOn);
        })
    .DataSource(dataSource =>
        // Make request to GetInviteeChangeHistory and provide the current ContactID as a route parameter
        dataSource
        .Ajax()
        .Read(read => read.Action("GetInviteeChangeHistory", "Contacts", new { contactId = Model.Contact.ContactID, eventId = "#=EventID#" }))
    )
        .Scrollable()
        .ToClientTemplate()
    )
</script>

Master grid code. Grid is populated by the model.

 

@(Html.Kendo().Grid(Model.EventHistory)
    .Name("contacteventhistorygrid")
    .Sortable()
    .Scrollable()
    .ClientDetailTemplateId("inviteehistorytemplate")
    .NoRecords()
    .HtmlAttributes(new { @class = "eb-table-header" })
    .Columns(c =>
        {
            c.Bound(e => e.EventID).Title("Event ID");
            c.Bound(e => e.EventDate).Title("Event Date").Format("{0: MM/dd/yyyy}");
            c.Bound(e => e.Name).Title("Event Name");
            c.Bound(e => e.TotalSeats).Title("Total Seats");
            c.Bound(e => e.PartyVenue2).Title("Theatre");
            c.Bound(e => e.PartyVenue1).Title("Party Venue");
        })
  
    .Events(events => events.DataBound("Contacts.fn.eventhistory_DataBound"))
)

JavaScript

 

eventhistory_DataBound: function (e) {
        this.expandRow(this.tbody.find("tr.k-master-row").first());
}

Screenshot of the results

 

 

Shawn
Top achievements
Rank 1
 answered on 06 Nov 2015
7 answers
479 views

When I try to add checkboxes to the TreeView,devtools int he browser show I am getting "Invalid Template"

This works (but no checkboxes).  But if I uncomment the ".Checkboxes part, it throws error.  I have tried many variants, including just ".Checkboxes(true)".

<script id="UserDetailsTemplate" type="text/kendo-tmpl">

    @*@Html.Kendo().TextBox().Value("foo #= User_Login#").Name("yoda_#=User_Login#")*@
    @(Html.Kendo()
          .TabStrip()
          .Name("userTabStrip_#=Person_ID#")
          .SelectedIndex(0)
          .Items((items) =>
                 {
                     items.Add()
                          .Text("Contact Info");
                     items.Add()
                          .Text("Permissions")
                          .Content(obj => Html.Kendo()
                                              .TreeView()
                                              .DataTextField("Name")
                                              .Name("userModulePermissions#=Person_ID#")
                                              //.Checkboxes(cbxConfig => cbxConfig.Enabled(true)
                                              //                                  .CheckChildren(true)
                                              //                                  .Name("checkedNodes"))
                                              .DataSource(d => d.Read("PermissionsTree_Read",
                                                                      "SettingsUsers"))
                                              .ToClientTemplate());
                     items.Add()
                          .Text("Group Membership");
                 })
          .ToClientTemplate()
          )
</script>

Here is the action the provides the tree data:

         public JsonResult PermissionsTree_Read(long? id)
        {
            var moduleId = id;
            var tracDB = new TRACEntities();
            // because modules & permissions are not same thing, we have to distinguish what "level" we are at in the tree
            // modules are root level, permissions (sub_sections) are next (leaf) level
            if (moduleId == null)
            {
                var result = GetOrgModules()
                    .Select(m => new {   
                                         id = m.Module_Type_ID,
                                         Name = m.Module_Type_Name,
                                         hasChildren = GetUserModuleSubsectionPermissions(m.Module_Type_ID).Any(),
                                         @checked = false
                    });
                return Json(result,
                            JsonRequestBehavior.AllowGet);
            }
            else
            {
                var result = GetUserModuleSubsectionPermissions((long) moduleId)
                    .Select(p => new {
                                         id = p.Sub_Section_Type_Id,
                                         Name = p.Sub_Section_Type_Desc,
                                         hasChildren = false,  //always leaves
                                         //@checked = false  //I have tried with and without this line -- it was just a guess that this was needed
                                     });
                return Json(result,
                            JsonRequestBehavior.AllowGet);
            }
        }

 

Dimo
Telerik team
 answered on 06 Nov 2015
1 answer
106 views

Here's my ViewModel

    public class EmailStartsViewModel
    {
        public int Year { get; set; }
        public int Week { get; set; }
        public int Starts { get; set; }
    }​

 I would like to display a line chart that has a category axis value for each week of the year i.e. 1 - 52, and that groups the data by year, so that it display a line for each year.

The data covers 2012 through the present, and looks like this: 

Year     Week Starts
2013    1         1
2015    1         11
2014    2         1
2015    2         8
2013    3         3
2015    3         20
2013    4         9
2015    4         30
2012    5        1
2013    5        3
2014    5        1
2015    5        18

etc up to week 53 (because of partial weeks) 

 

With these settings 

                  .DataSource(ds => ds
                      .Read(read => read
                          .Action("StartData", "Starts")
                          .Data("StartSettings"))
                      .Group( group => group.Add(model => model.Year))
                              .Sort(sort => sort.Add(model => model.Week))
                  )
                  .Series(series =>
                  {
                      series.Line(model => model.Starts, categoryExpression: model => model.Week).Name("Starts");

                  })
                  .CategoryAxis(axis => axis
                      .Categories(model => model.Week)
                  )​

It starts with week 5 which is the first week that has data in the first year. Weeks 1-4 aren't displayed

I've tried various combinations like directly specifiying the categories 

.CategoryAxis(axis => axis
                      .Categories("1", "2", "3", "4", "5", "6"....."52"))

and removing the categoryExpression in 

series.Line(model => model.Starts, categoryExpression: model => model.Week).Name("Starts");​

and it either doesn't show all the weeks, or puts values in the wrong category, or both.

 What's the right way to go about this?

 

Iliana Dyankova
Telerik team
 answered on 06 Nov 2015
3 answers
723 views

 The treeview events demo has event handlers such as the following:

         function onCheck(e) {

                  kendoConsole.log("Checkbox changed :: " + this.text(e.node));

                  //???????  do something useful  ?????

         }

But how would I do something useful, like get ID, checked status (checked or unchecked), or other fields of the item checked?

If the data source has model with fields "Id", "name", "something", how would I get those values?

Boyan Dimitrov
Telerik team
 answered on 06 Nov 2015
3 answers
698 views

I wish to connect the treeview checkboxes to an "enabled" field for records in my database.

Specifically, when a checkbox is clicked, I want to all an action to update the corresponding enabled field.

Also, with checkchildren(true), I want to likewise update the enabled field of all children.

What are the basics of how to do this?

The only demo using checkboxes also uses hard-coded tree items, with no connection to remote data.

Alex Gyoshev
Telerik team
 answered on 06 Nov 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?