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

 

How do I cause the MVC Grid to support insert only and no other operation. This is my code

 

@(Html.Kendo().Grid<SomeViewModel>()
          .Name("SomeGrid")
                  .ToolBar(toolbar =>
                      {
                          toolbar.Create();
                          toolbar.Save();
                      })     
          .Columns(columns =>
          {
              columns.Bound(p => p.Name).ClientTemplate(@"<input type='radio' name='SomeName'> #= Name # </input>");
              columns.Bound(p => p.DateCreated);
              columns.Command(command => { command.Edit(); });
          })
                  .Editable(editable => editable.Mode(GridEditMode.InCell))
          .Events(e => e.DataBound("onDataBound"))
          .Selectable(selectable => selectable.Enabled(true).Mode(GridSelectionMode.Single).Type(GridSelectionType.Row))
          .Scrollable()
          .Filterable()
          .HtmlAttributes(new { style = "height:200px;" })
          .DataSource(dataSource => dataSource
              .Ajax()
                      .Batch(true)
              .Events(events => events.Error("onError"))
              .Model(model =>
              {
                  model.Id(s => s.unique);
                  model.Field(s => s.DateCreated).Editable(false);
              })
              .Read(read => read.Action("GetSolutions", "Solutions"))               
              .Create(create => create.Action("SomeAction", "SomeController"))
              .Update(create => create.Action("SomeAction", "SomeController"))
               
               
              ))

 

 

Also, it looks like I have to implement the .Update method above even though I don't want to support updates. If I don't do that I get error "The update data binding setting is required by edit command".

 

Ideally, it would have been nice to keep the update completely disassociated with inserting but looks like that's not the case and may be there has to be some hack to cause edit not to happen. Can someone please let me know this hack ?

Marin
Telerik team
 answered on 09 May 2016
1 answer
172 views

Hello 

I have such case that some rows in Grid have details rows.

Main Row and Detail Row one common column "OrderNumber"

Question:

 

How to make man grid be able to include detail grid in filtering by ordering number?

Konstantin Dikov
Telerik team
 answered on 09 May 2016
3 answers
1.4K+ views

 

I am using Kendo UI Grid

@(Html.Kendo().Grid<SomeViewModel>()
 .Name("SomeGrid")
 .Columns(columns =>
 {
        columns.Bound(p => p.Id);
 })
 .Events(e => e.DataBound("onDataBound"))
 .Selectable(selectable => selectable.Enabled(true).Mode(GridSelectionMode.Single).Type(GridSelectionType.Row))
    .Scrollable()
 .Filterable()
    .DataSource(dataSource => dataSource
 .Ajax()
 .Read(...)
 )
 )

When the row is selected the color changes to orange. How do I remove the css style performing this color change. In other words when row is selected I don't want any color changing.

 

 

 

Daniel
Telerik team
 answered on 09 May 2016
1 answer
264 views

I have a chart with two series, both grouped by an identical category field. When I display the tooltip I want to be able to hide items that have a value of zero. How would I do this?

Here is my code for the chart, and I attached a screenshot of it:

@(Html.Kendo().Chart<JobChartVm>()
 .Name("durationChart")
 .Theme("Bootstrap")
 .Title("Execution Time & Error Counts By Job (Last 7 Days)")
 .Legend(legend => legend
 .Position(ChartLegendPosition.Top)
 .Labels(labels => labels.Padding(0, 20, 0, 0))
 .Padding(5, 5, 5, 20)
 .Background("#f5f5f5")
 .Border(1, "#ddd", ChartDashType.Solid)
 )
 .DataSource(dataSource => dataSource
 .Read(read => read.Action("GetJobChartData", "Admin"))
 .Group(group => group.Add(model => model.Entity.JobName))
 .Sort(sort => sort.Add(model => model.Entity.TimeStamp).Ascending())
 )
 .SeriesDefaults(seriesDefaults =>
 seriesDefaults.Line().Style(ChartLineStyle.Smooth)
 )
 // in order not to duplicate the legend we need to specify 1 unique color per group
 .SeriesColors("#428bca", "#5bc0de", "#5cb85c", "#f2b661", "#e67d4a", "#da3b36", "#967adc")
 .Series(series =>
 {
 series
 .Line(model => model.Entity.Duration, categoryExpression: model => model.Entity.TimeStamp)
 .Aggregate(ChartSeriesAggregate.Avg)
 .Notes(notes => notes.Label(label => label.Position(ChartNoteLabelPosition.Outside)).Position(ChartNotePosition.Bottom))
 .Name("#= group.value #")
 .Tooltip(tooltip => tooltip
 .Visible(true)
 .Format("{0:N0}s")
 );
 series
 .Column(model => model.Failures, categoryExpression: model => model.Entity.TimeStamp)
 .Aggregate(ChartSeriesAggregate.Sum)
 .VisibleInLegend(false)
 .Gap(0.2)
 .Spacing(0.1)
 .Name("#= group.value #")
 .Tooltip(tooltip => tooltip
 .Visible(true)
 .Format("{0:N0} errors")
 );
 })
 .CategoryAxis(axis => axis
 .Date()
 .Labels(labels => labels.Rotation(-90))
 .BaseUnit(ChartAxisBaseUnit.Fit)
 .Crosshair(c => c.Visible(true))
 )
 .ValueAxis(axis => axis
 .Logarithmic()
 .MinorGridLines(minorGridLines => minorGridLines.Visible(true))
 .Labels(labels => labels.Format("{0:N0}"))
 .Title("Execution Time (sec) / Error Count")
 .Min(0.9)
 .AxisCrossingValue(0.9)
 )
 .Tooltip(tooltip => tooltip
 .Visible(true)
 .Shared(true)
 )
 .Events(events => events
 .DataBound("function(e){ kendo.ui.progress($('#durationChart'), false); }")
 )
 .Pannable(pannable => pannable
 .Lock(ChartAxisLock.Y)
 )
 .Zoomable(zoomable => zoomable
 .Mousewheel(mousewheel => mousewheel.Lock(ChartAxisLock.Y))
 .Selection(selection => selection.Lock(ChartAxisLock.Y))
 ))

Stamo Gochev
Telerik team
 answered on 09 May 2016
2 answers
192 views
I am attempting to add an "OK" button to the client template of each Notification that will close the focused notification when the user clicks it.  I have reviewed the documentation and I can find how to close ALL notifications but not one's individually via a button within the client template.  Any would greatly appreciate any assistance on how to perform this action.  Thank you!
Dimitar
Telerik team
 answered on 06 May 2016
3 answers
1.0K+ views

How do I Switch the settings for the thousand separator and the decimal separator?

 

currently the decimal value : 2510.012 is displayed as 2,510.012

I want to make it so it is displayed as: 2.510,012

Alex Gyoshev
Telerik team
 answered on 06 May 2016
1 answer
95 views

Hello,

I have a grid with collapsible rows and the grid also allows Filtering and Sorting. When I have a few rows collapsed and click on a column to sort, all the collapsed rows  expand. Is there a way to retain the collapsed state of rows on Sorting/ Filtering?

 

Thanks!

Konstantin Dikov
Telerik team
 answered on 06 May 2016
7 answers
211 views

1)  I noticed the grid read action is being called when the grid-filter image is clicked on the column header.    Is there a reason it is being called when .ServerOperation(false) is specified ?

 

2)  Is there a way to remove the grid-filter from the column header when the grid has no rows  to prevent the user from filtering an empty grid ?

 

Thanks,

Irwin

 

Kiril Nikolov
Telerik team
 answered on 06 May 2016
7 answers
1.0K+ views
Hi there,

There seems no "Theme" property for me to change the style of the grid, I couldn't find in anywhere but in your demo there is a dropdown to choose to see different themes, am I missing anything?

here is my code:

@(Html.Kendo().Grid(Model.Customers)
        .Name("GridCustomers")

        .Columns(columns =>
        {
            columns.Bound(p => p.ID).Title("ID");
            columns.Bound(p => p.Name).Title("Name").Width(130);
            columns.Bound(p => p.Telephone).Title("Telephone").Width(130);
            columns.Bound(p => p.Extension).Title("Extension").Width(130);
            columns.Bound(p => p.Group).Title("Group");
        })
        .Pageable()
        .Sortable()
        .Scrollable(scr => scr.Height(430))
        .Filterable()
        .DataSource(dataSource => dataSource
            .Ajax()
            .PageSize(20)
            .ServerOperation(false)
         )
)

Thanks
Ziming
Dimo
Telerik team
 answered on 05 May 2016
6 answers
1.0K+ views

Hi,

I have a form with a MultiSelect displaying 'Exercises'. When the form is submitted the Exercise data is passed to the model as part of the form data (e.g.Exercises:"f86a60ce-04dc-4208-a2b6-a5ee00a1990f")

However when nothing is selected in the list, the 'Exercises' parameter is excluded from the post data. As the Exercise data is not included, the model.Entity.Exercises remains unchanged and contains the original selected values.

Is there any way the Kendo MultiSelect can pass in a null value when posting an empty list, so that the form data includes the Exercise parameter? e.g. Exercises:Null 

 

@{if (edit)
{
  @(Html.Kendo().MultiSelect()
  .Name("Exercises")
  .Placeholder("  ")
  .BindTo(ViewBag.Exercises)
  .HtmlAttributes(new { @class = "universalWidth" }))
}

[HttpPost]
[ActionName("CourseEdit")]
public ActionResult CourseEditPost(TypedModel<Course> model, string mode)
{
  if (mode != "view")
  {
    if (UserController.EffectiveUser.GetClassAccess(typeof(Course)).Allows(Access.Update))
    {
      // Save Mode
      if (mode == "new")
      {
 
      }
      else if (mode == "edit")
      {           
        CourseService service = new CourseService(this.DbSession, new ModelStateWrapper(this.ModelState));
        if (service.Save(model)) //model.Entity.Exercises error when no exercises selected in list
        {
          //Sucessfully saved
          DbSession.Flush();
        }
      }
    }
  }
 
  CourseEditHelper(model);
  return View(model);
}

     

Nencho
Telerik team
 answered on 05 May 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?