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

Hi,

I have a requirement to have a TreeList which has up to 4 levels. I have the filter option enabled which gives me a filter to say Contains '' for example. When the first loads it loads with all nodes closed. When I apply the filter it only filters on what is shown directly in the view, so in this case on the top level items. Is there a way that it can filter on any child node as well, such that if a level 4 child node contained '' for example it would show the item expanded with the various parent nodes?

I can set it so that the view is always expanded, but then each time the view is rebound any user alterations to the expanded state are  by the expansion. 

Thanks,

Neil

Stefan
Telerik team
 answered on 10 Aug 2017
3 answers
162 views

Hello,

I have a requirement to filter some prices using pre-defined values like the following:

  • Less than £10
  • Between £10 and £20
  • Between £20 and £30
  • More than £30

I can't seem to see a way to do this with the Grid. Is it possible?

Thank you

Lucy

Viktor Tachev
Telerik team
 answered on 09 Aug 2017
7 answers
881 views

I have a grid with a custom command and a client-side function specified for the grid's DataBound event. In the DataBound function, I hide the custom command on rows where a particular column has a certain value. My code is successfully showing the custom button only on the appropriate rows when the grid is displayed. I've also specified a custom popup editor for the grid.
Skeleton of the grid code is:

@(Html.Kendo().Grid<Models.Task>()
            .Name("gridTask")
            .Columns(columns =>
                    {
                        columns.Bound(task => task.Name);
                        columns.Bound(task => task.TaskStatus);
                        columns.Command(cmd =>
                        {
                            cmd.Edit();
                            cmd.Custom("Show Survey").Click("ShowSurvey");
                        });
                    })
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(10)
                    .ServerOperation(false)
                .Model(model => model.Id(m => m.Task_ID))
                .Read(read => read.Action("ReadTask", "TaskPartial"))
                .Update(update => update.Action("UpdateTask", "TaskPartial"))
                .Create(update => update.Action("CreateTask", "TaskPartial"))
            )
             .Events(e =>
             {
                 e.Cancel("EditCancel");
                 e.DataBound("TaskDataBound");
             })
            .Pageable()
            .Sortable()
            .Editable(ed => {
                ed.Mode(GridEditMode.PopUp);
                ed.TemplateName("TaskEditor");
                ed.Window(win => win.Title("Task Editor"));
            })
)

And the DataBound function is:

function TaskDataBound(e) {
        // Check the Show Survey button in each task row. Remove the button if the row has a certain value.
        $("[id^='gridTask'] tbody tr .k-grid-ShowSurvey").each(function () {
            var currentDataItem = $("[id^='gridTask']").data("kendoGrid").dataItem($(this).closest("tr"));
            //Check the current dataItem to see if the button should be removed
            if (currentDataItem.testValue == 0) {
                $(this).remove();
            }
        })
    }

Now suppose I click Edit on a row which does not show the custom button, and the edits I make do not effect the column determining the visibility of the custom button. When I click Update in the popup editor, the screen is updated as expected. The popup goes away, the updated data is shown, and the grid row still does not show the button.

However, when I click Cancel in the popup editor, the popup goes away but the custom command incorrectly reappears on the grid row, even though the column determining the visibility of the custom command hasn't changed. Why is the custom command mistakenly re-appearing? 

I've tried specifying a client-side function for the Cancel event as follows to remove the custom button upon the cancel. Even though I've traced the code to confirm my cancel function is called and the remove() command is hit and executed, the Custom button still comes back.

 function EditCancel(e) {
        // Check the Show Survey button in each task row. Remove the button if the row has a certain value.
        $("[id^='gridTask'] tbody tr").each(function () {
            var currentDataItem = $("[id^='gridtask']").data("kendoGrid").dataItem($(this));
            //Check the current dataItem to see if the button should be removed
            if (currentDataItem.testValue == 0) {

                $(this).find(".k-grid-ShowSurvey").remove();
            }
        })
    }

Georgi
Telerik team
 answered on 08 Aug 2017
1 answer
376 views

We want to customize the DataSource Export so that it will work against any datasource regardless of the number of columns.

In the example, the cells and columns are hard coded.  We want to modify the example to read the datasource and dynamically generated the bolded sections below.

See attached.

Any ideas would be appreciated.

Alex Hajigeorgieva
Telerik team
 answered on 08 Aug 2017
3 answers
2.5K+ views

HI

I found a problem about ASP.NET MVC Grid : 

After web page loaded, the grid is empty (AutoBind(false), so there have no any data),
Click any column header (will invoke column sorting) but read action invoked unexpectedly,
even if ServerOperation(false).

  @(Html.Kendo().Grid<HIS.Entity.Models.TYourModel1>()
    .Name("SelectionGrid")
    ... Sortable is true ...
    .AutoBind(false)
    .Pageable(pageable => pageable.Enabled(false))
    .Columns(columns =>
    {
      columns.Bound(column => column.xxxxx).Hidden();
    })
    .DataSource(dataSource =>
    {
      dataSource.Ajax()
        .Batch(true)
        .Model(model => model.Id(m => m.Key1))
        .PageSize(20)
        .ServerOperation(false)
        .Events(events =>
        {
          events.DefaultEvents();
        })
        .Read(read => read.Action("Selection_Read", "YourController").Data("filterSelectionGrid"));
    })
    .Events(events =>
    {
    })
    .HtmlAttributes(new { @style = "height: 85%; min-height: 180px" }))


Grid sorting ServerOperation(false) behavior not matched with description - 
'... If set to false ... paging, sorting, filtering ... will be performed client-side' : 

    // Summary:
    //     Sets the operation mode of the DataSource. By default the DataSource will make
    //     a request to the server when data for paging, sorting, filtering or grouping
    //     is needed. If set to false all data will be requested through single request.
    //     Any other paging, sorting, filtering or grouping will be performed client-side.
    //
    // Parameters:
    //   enabled:
    //     True(default) if server operation mode is enabled, otherwise false.
    public TDataSourceBuilder ServerOperation(bool enabled);


UI for ASP.NET MVC R2 2017 SP1
Visual Studio 2015 Enterprise

Best regards

Chris

 

 

Stefan
Telerik team
 answered on 08 Aug 2017
3 answers
557 views
Hi, I looking for an example to display a list of products information in mvc grid together with the barcode. is it possible?

@(Html.Kendo().Grid<Example.Models.ProductViewModel>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(c => c.ProductName).Width(140);
columns.Bound(c => c.ProductCode).Width(190);
 <----this column should display barcode generated using Product code, ---->
@(Html.Kendo().Barcode().Name("barcode").Value(c => c.ProductCode).Encoding(BarcodeSymbology.Code39).Width(200).Height(100))
   

})
.HtmlAttributes(new { style = "height: 380px;" })
.Scrollable()
.Groupable()
.Sortable()
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("Products_Read", "Grid"))
)
)


Regards
cwk
Viktor Tachev
Telerik team
 answered on 08 Aug 2017
1 answer
388 views

Hi Team,

 

when i try to add new scaffolding item from my controller class, i could not able to see Kendo UI Template, i tried to click all the left hand side menu options, but no luck.

 

I tried this option with VS 2013,2015. but its not working .i am using telerik trial version

 

telerik.ui.for.aspnetmvc.2017.2.621.trial

 

watch this video : https://www.youtube.com/watch?v=Tmz_j2GrJBk and try the option from 6.48 time line

 

Thanks

Sundar

Dimiter Madjarov
Telerik team
 answered on 07 Aug 2017
3 answers
431 views

Hi,

im trying to export PDF from my kendo grid but im facing some issues with pdf export settings. 

@(Html.Kendo().Grid<Statistics.Models.Inspection>()
           .Name("grid")
           .Pdf(pdf => pdf
           .AllPages()
           .PaperSize("A4")
           .AvoidLinks()
           .Scale(0.8)
           .RepeatHeaders()
           .Margin("2cm", "1cm", "1cm", "1cm")
           .TemplateId("page-template")
           .FileName("Export.pdf")
 
       )
       .Excel(exc=>exc.AllPages(true).Filterable(true).FileName("exc.xlsx"))

 

Excel is working fine.

But PDF always exports only 1 visible page from the grid (and only few columns that fit to the page). I figured out that if i remove .PaperSize("A4") it is showing all data BUT its completely ignoring template and it renders grid to pdf with all buttons. 

 

Thanks 

Stefan
Telerik team
 answered on 07 Aug 2017
3 answers
716 views

Hi, I'm trying to create a custom popup editor for my grid, however, the drop downs are not being populated or at least won't open at all.  I'm stumped.  The controller method does get hit and I see 3 values but the drop downs down open.  When I first click on them I see a quick activity indicator appear but that's it.

 

Popup editor code

@(Html.Kendo().DropDownList()
          .Name("PressureGroupNm")
          .DataTextField("PressureGroupNm")
          .DataValueField("PressureGroupNm")
          .DataSource(source =>
          {
              source.Read(read =>
              {
                  read.Action("GetPressureTypeGroups_ForDropDown", "Group");
              });
          })
          .HtmlAttributes(new { style = "width: 60%" })
        )
        @Html.ValidationMessageFor(model => model.PressureGroupNm)

 

Controller code

public ActionResult GetPressureTypeGroups_ForDropDown()
      {
 
           
          return Json(GetGroups(), JsonRequestBehavior.AllowGet);
           
      }
 
      private IEnumerable<PressureTypeGroup> GetGroups()
      {
           
          return db.PressureTypeGroups.Select(pg => new PressureTypeGroup
          {
              PressureGroupNm = pg.PressureGroupNm,
              PressureTypeGroupTblId = pg.PressureTypeGroupTblId
          });
      }
Stefan
Telerik team
 answered on 07 Aug 2017
3 answers
417 views
I am using the Files method of the Upload widget to show previously uploaded files and would like to make these files downloadable (by clicking the file name).

The approach I planned on taking was to modify the default file template to invoke a JS script method when the filename is clicked. Where is the default file template located?

Alternatively, is there a better way to accomplish this?
Ivan Danchev
Telerik team
 answered on 03 Aug 2017
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?