Telerik Forums
UI for ASP.NET MVC Forum
3 answers
697 views

Hi

Is it possible to disable the operators button for all cells (in row filter mode) without having to apply it to every column.

At the moment I have the code below but ideally just want this applied at a more global level

    columns.Bound(c => c.JobTitle).Width(400).Filterable(f => f.Cell(cell => cell.ShowOperators(false)));

Thanks

Andy

Georgi
Telerik team
 answered on 23 Jan 2019
3 answers
882 views
I'm working with a grid in asp.net mvc, where I have a model containing several properties. One of its properties (Id) is a Guid. Whenever I try to create a new row in my grid, entering all details (Id is automatically generated by a backend server when saved) and press "Update", I get an error saying "The Id field is required". Is there a way to get around this?
I suspect the Guid-type to be the one causing trouble here.
Here's my grid:
@(Html.Kendo().Grid<ToolModel>()
      .Name("grid")
      .Columns(columns =>
      {
          columns.Bound(p => p.Displace);
          columns.Bound(p => p.FishingNectOd);
          columns.Bound(p => p.Length);
          columns.Bound(p => p.Model);
          columns.Bound(p => p.Name);
          columns.Bound(p => p.Supplier).Width(150);
          columns.Bound(p => p.TagId);
          columns.Bound(p => p.ToolOd);
          columns.Bound(p => p.Type);
          columns.Bound(p => p.Weight);
          columns.Command(command => { command.Edit(); command.Destroy(); }).Width(180);
      })
      .ToolBar(toolbar => toolbar.Create())
      .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("ToolPopUpTemplate"))
      .Pageable()
      .Sortable()
      .Scrollable()
      .HtmlAttributes(new { style = "height:500px;" })
      .DataSource(dataSource => dataSource
          .Ajax()
          .PageSize(10)
          .Events(events => events.Error("error_handler"))
          .Model(model => model.Id(toolModel => toolModel.Weight))
          .Create(update => update.Action("EditingPopup_Create", "ToolManagement"))
          .Read(read => read.Action("EditingPopup_Read", "ToolManagement"))
          .Update(update => update.Action("EditingPopup_Update", "ToolManagement"))
          .Destroy(destroy => destroy.Action("EditingPopup_Destroy", "ToolManagement"))
      ))
Template:
@using Services.Models.Tool
@model ToolModel
 
<div class="editor-label">
    @(Html.LabelFor(model => model.Displace))
</div>
<div class="editor-field">
    @(Html.TextBoxFor(model => model.Displace))
</div>
<div class="editor-label">
    @(Html.LabelFor(model => model.FishingNectOd))
</div>
<div class="editor-field">
    @(Html.TextBoxFor(model => model.FishingNectOd))
</div>
<div class="editor-label">
    @(Html.LabelFor(model => model.Length))
</div>
<div class="editor-field">
    @(Html.TextBoxFor(model => model.Length))
</div>
<div class="editor-label">
    @(Html.LabelFor(model => model.Model))
</div>
<div class="editor-field">
    @(Html.TextBoxFor(model => model.Model))
</div>
<div class="editor-label">
    @(Html.LabelFor(model => model.Name))
</div>
<div class="editor-field">
    @(Html.TextBoxFor(model => model.Name))
</div>
<div class="editor-label">
    @(Html.LabelFor(model => model.Supplier))
</div>
<div class="editor-field">
    @(Html.TextBoxFor(model => model.Supplier))
</div>
<div class="editor-label">
    @(Html.LabelFor(model => model.TagId))
</div>
<div class="editor-field">
    @(Html.TextBoxFor(model => model.TagId))
</div>
<div class="editor-label">
    @(Html.LabelFor(model => model.ToolOd))
</div>
<div class="editor-field">
    @(Html.TextBoxFor(model => model.ToolOd))
</div>
<div class="editor-label">
    @(Html.LabelFor(model => model.Type))
</div>
<div class="editor-field">
    @(Html.TextBoxFor(model => model.Type))
</div>
<div class="editor-label">
    @(Html.LabelFor(model => model.Weight))
</div>
<div class="editor-field">
    @(Html.TextBoxFor(model => model.Weight))
</div>

Controller:
public class ToolManagementController : Controller
{
    private static readonly ILog Log = LogManager.GetLogger("ToolManagementController.class");
    public ToolServiceClient ToolService { get; set; }
 
    public ToolManagementController()
    {
        try
        {
            ToolService = new ToolServiceClient();
        }
        catch (Exception e)
        {
            Log.Error(e);
        }
    }
 
    // GET: ToolManagement
    public ActionResult Tools()
    {
        return View();
    }
 
    public ActionResult EditingPopup_Read([DataSourceRequest] DataSourceRequest request)
    {
        ToolContract[] list = ToolService.GetTools();
        return Json(list.ToDataSourceResult(request));
    }
 
    [AcceptVerbs(HttpVerbs.Post)]
    public ActionResult EditingPopup_Create([DataSourceRequest] DataSourceRequest request, ToolModel tool)
    {
        if (tool != null && ModelState.IsValid)
        {
            ToolService.CreateTool(new ToolContract
            {
                Displace = tool.Displace,
                FishingNectOD = tool.FishingNectOd,
                Length = tool.Length,
                Model = tool.Model,
                Name = tool.Name,
                Supplier = tool.Supplier,
                TagId = tool.TagId,
                ToolOD = tool.ToolOd,
                Type = tool.Type,
                Weight = tool.Weight
 
            });
        }
 
        return Json(new[] { tool }.ToDataSourceResult(request, ModelState));
    }
 
    [AcceptVerbs(HttpVerbs.Post)]
    public ActionResult EditingPopup_Update([DataSourceRequest] DataSourceRequest request, ToolModel tool)
    {
        if (tool != null && ModelState.IsValid)
        {
            ToolService.UpdateTool(new ToolContract
            {
                Displace = tool.Displace,
                FishingNectOD = tool.FishingNectOd,
                Length = tool.Length,
                Model = tool.Model,
                Name = tool.Name,
                Supplier = tool.Supplier,
                TagId = tool.TagId,
                ToolOD = tool.ToolOd,
                Type = tool.Type,
                Weight = tool.Weight,
                Id = tool.Id
            });
        }
 
        return Json(new[] { tool }.ToDataSourceResult(request, ModelState));
    }
 
    [AcceptVerbs(HttpVerbs.Post)]
    public ActionResult EditingPopup_Destroy([DataSourceRequest] DataSourceRequest request, ToolModel tool)
    {
        if (tool != null)
        {
            ToolService.DeleteTool(tool.Id);
        }
 
        return Json(new[] { tool }.ToDataSourceResult(request, ModelState));
    }
 
}

Finally, the model:
public ToolModel(ToolContract toolContract)
{
    ToolContract = toolContract;
}
 
public ToolModel()
{
}
 
private ToolContract ToolContract
{
    get { return _toolContract ?? (_toolContract = new ToolContract()); }
    set { _toolContract = value; }
}
 
 
public double? Displace
{
    get { return ToolContract.Displace; }
    set { ToolContract.Displace = value; }
}
 
 
public double? FishingNectOd
{
    get { return ToolContract.FishingNectOD; }
    set { ToolContract.FishingNectOD = value; }
}
 
[ScaffoldColumn(false)]
public Guid Id
{
    get { return ToolContract.Id; }
    set { ToolContract.Id = value; }
}
 
public double? Length
{
    get { return ToolContract.Length; }
    set { ToolContract.Length = value; }
}
 
public string Model
{
    get { return ToolContract.Model; }
    set { ToolContract.Model = value; }
}
 
public string Name
{
    get { return ToolContract.Name; }
    set { ToolContract.Name = value; }
}
 
public string Supplier
{
    get { return ToolContract.Supplier; }
    set { ToolContract.Supplier = value; }
}
 
public string TagId
{
    get { return ToolContract.TagId; }
    set { ToolContract.Supplier = value; }
}
 
[Display(Name = "Outer Diameter")]
public double? ToolOd
{
    get { return ToolContract.ToolOD; }
    set { ToolContract.ToolOD = value; }
}
 
public string Type
{
    get { return ToolContract.Type; }
    set { ToolContract.Type = value; }
}
 
public double? Weight
{
    get { return ToolContract.Weight; }
    set { ToolContract.Weight = value; }
}
}
Viktor Tachev
Telerik team
 answered on 23 Jan 2019
1 answer
170 views
Is there any way to add a template to a MenuButton? 
Eyup
Telerik team
 answered on 23 Jan 2019
1 answer
170 views

     Is it possible to make the PDF work in a way so every time a certain field changes, it starts on new page? For example if the field I want to determine this is "CarMakes" and when its value changes from BMW to Ferrari, Ferrari starts on a new page in the PDF document?

Viktor Tachev
Telerik team
 answered on 23 Jan 2019
6 answers
423 views

 Hello,

is it possible when using the built-in PDF export functionality to make it list each grouped section (created via Ajax().Group()) onto its own page?

I'm required to create two types of reports. One that exports all items combined into a single report and a second one that exports based on grouping of a specific column. I have the grid grouped correctly but when exporting, I need each group on it's own page rather than displayed all in one grid.

Is there built-in functionality for this or a known work-around?

Thank you.

Tsvetina
Telerik team
 answered on 22 Jan 2019
2 answers
146 views

Hi,

I have a Word document I use as template, the document contains multiple sections, page breaks and column breaks. When the PDF is exported, I got every section in a new page and all pages with multiple columns render as one column.

Am I missing some setting in the export?

Thanks for the help!

Eliel
Top achievements
Rank 1
 answered on 21 Jan 2019
10 answers
2.8K+ views
I found out how to export a single grid to excel from the grid but how would you export a grid that contains client templates?  Is it even possible?

Thanks.....
Ezequiel
Top achievements
Rank 2
 answered on 21 Jan 2019
10 answers
208 views

Hello,

I'm looking at the "editing_custom" grid example for ASP.NET MVC and wondering if there is a way to bind the drop down without ViewData?  I would like to use a generic ViewModel with Value and Text pairs similar to our existing MVC solution.  I am asking this because there is no reusability when populating the CategoryViewModel and ViweData in the controller.  Only the EditorTemplate can be reused.

@model Kendo.Mvc.Examples.Models.CategoryViewModel

@(Html.Kendo().DropDownListFor(m => m)
        .DataValueField("CategoryID")
        .DataTextField("CategoryName")
        .BindTo((System.Collections.IEnumerable)ViewData["categories"])
)

Also, how do you add a "--Select a Category--" at the top of the dropdown list (in your example and in a non-ViewData approach)?

Thanks

John

Viktor Tachev
Telerik team
 answered on 21 Jan 2019
7 answers
1.3K+ views

Hello,

Would someone be able to offer the solution on how to get certain node's data which is dynamic loaded (load on demand)?

The case is that in my MVC project the top level node have already be loaded on TreeView . I need load second level to fourth level node based on every level's condition (on one button click). My problem is I cannot get second level's detail data (after the nodes appended to top level ) which third level depend on. When I do the debug the count of second level nodes showed correctly, but not detail data anywhere. Do you have some suggestions? Thanks in advance!

Daochuen
Top achievements
Rank 1
Iron
Veteran
Iron
 answered on 18 Jan 2019
3 answers
399 views
Is it possible to call an ActionResult in my controller in the refresh?

I need to pass the ID to my Controller to get back data.

windowObject.refresh({
    url: "/feedbackForm"
});
Marin Bratanov
Telerik team
 answered on 18 Jan 2019
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
Security
ColorPicker
DateRangePicker
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
LLM Kit
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?