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

How to include filter options in the header template for a grid when exporting to PDF. For example, if user has filtered a grid column by say username = 'John', I need to change the header template to contain the text 'Sorted by username: John' in the PDF header.

The filter options should only be displayed in the exported files and not in the webpage. Can it be implemented in both - JavaScript and asp.net?

Stefan
Telerik team
 answered on 28 Sep 2017
2 answers
766 views

Hello there guys, i need your help. i have a batch edit grid view. And when i click on particular cell, i get the correct column name  of the clicked cell as long as the grid is un-grouped. When i group the columns in the grid, the name are all wrong.

Here is my grid

01.@(Html.Kendo().Grid<P2I_UI.Models.ViewM.Plan>()
02.    .Name("PlanGrid")
03.    .Columns(columns =>
04.    {
05.        columns.Group(ScriptGroup => ScriptureGroup
06.               .Title("<center>Scripture</center>")
07.               .Columns(dd =>
08.               {
09.                   dd.Bound(e => e.MaterialCategory).Title("Type").Width(110).HtmlAttributes(new { @style = "text-align:center; font-weight:normal; font-size:80%" }).ClientTemplate("#=MaterialCategory.ShortName#").Sortable(false);
10.                   dd.Bound(e => e.Product).Title("Item No").Width(130).HtmlAttributes(new { @style = "text-align:center; font-weight normal; font-size:80%" }).ClientTemplate("#=Product.ItemNumber#").Sortable(false);
11.                   dd.Bound(e => e.ProductName).Title("Description").Width(160).HtmlAttributes(new { @style = "text-align:center; font-weight normal; font-size:80%" });
12.               })
13.        );
14.        columns.Bound(c => c.ProjectEOYInventoryAssigned).Title("Proj.<br>EOY Inv<br>Assgnd").Width(71).HeaderHtmlAttributes(new { style = "text-align:right; font-weight: normal; font-size:85%" }).HtmlAttributes(new { @style = "text-align:right; font-weight:normal; font-size:80%" }).Format("{0:,#}");
15.        columns.Group(OuterGrantQuantity => OuterGrantQuantity
16.              .Title("<center>Grant Quantity</center>")
17.              .Columns(ogq =>
18.              {
19.                  ogq.Bound(e => e.Quarter1).Title("Q1").Width(95).HtmlAttributes(new { @style = "text-align:right; font-weight: normal; font-size:80%" }).Format("{0:,#}");
20.                  ogq.Bound(e => e.Quarter2).Title("Q2").Width(95).HtmlAttributes(new { @style = "text-align:right; font-weight: normal; font-size:80%" }).Format("{0:,#}");
21.                  ogq.Bound(e => e.Quarter3).Title("Q3").Width(95).HtmlAttributes(new { @style = "text-align:right; font-weight: normal; font-size:80%" }).Format("{0:,#}");
22.                  ogq.Bound(e => e.Quarter4).Title("Q4").Width(95)..HtmlAttributes(new { @style = "text-align:right; font-weight: normal; font-size:80%" }).Format("{0:,#}");
23.              })// end of the column
24.        );
25.columns.Bound(e => e.TotalGrantedRequest).Title("Tot.<br>Granted<br>Req").Width(72).HtmlAttributes(new { @style = "text-align:right; font-weight:normal; font-size:80%" }).Format("{0:,#}");
26.        columns.Bound(e => e.StandardCostPerUnit).Title("Cost<br>Per Unit").Width(72)..HtmlAttributes(new { @style = "text-align:right; font-weight:normal; font-size:80%" }).Format("{0:c}");
27.        columns.Bound(e => e.EstimatedGrantedCost).Title("Est.<br>Granted<br>Cost").Width(73)..HtmlAttributes(new { @style = "text-align:right; font-weight: normal; font-size:80%" }).Format("{0:c0}");
28.        columns.Bound(e => e.TotalNumberNeeded).Title("Tot.<br>Number<br>Needed").Width(75).HtmlAttributes(new { @style = "text-align:right; font-weight: normal; font-size:80%" }).Format("{0:,#}");
29.        columns.Command(e => e.Destroy().Text(" ").HtmlAttributes(new { @title = "Delete" })).Width(1);
30.    })
31.    .ToolBar(toolbar => { toolbar.Create(); toolbar.Save(); })
32.    .Editable(editable => editable.Mode(GridEditMode.InCell))
33.    .Events(events =>
34.    {
35.        events.Edit("onEditPlanGrid");
36.    })
37.    .Navigatable()
38.    .Sortable()
39.    .DataSource(dataSource => dataSource
40.        .Ajax()
41.        .Batch(true)
42.        .PageSize(30)
43.        .ServerOperation(false)
44.        .Model(model =>
45.        {
46.            model.Id(p => p.PlanScriptureID);
47.            model.Field(p => p.MaterialCategory).DefaultValue(ViewData["defaultMaterialCategory"] as P2I_UI.Models.ViewM.MaterialCategoryVM);
48.            model.Field(p => p.Product).DefaultValue(ViewData["defaultProduct"] as P2I_UI.Models.ViewM.ProductVM);
49.            model.Field(p => p.ProjectEOYInventoryAssigned);
50.            model.Field(p => p.TotalGrantedRequest).Editable(false);
51.            model.Field(p => p.StandardCostPerUnit);
52.            model.Field(p => p.EstimatedGrantedCost).Editable(false);
53.            model.Field(p => p.TotalNumberNeeded).Editable(false);
54.        })
55.        .Create("Script_Create", "Plan")
56.        .Read("Script_Read", "Plan")
57.        .Update("Script_Update", "Plan")
58.        .Destroy("Script_Delete", "Plan")
59.        .Events(e1 => e1.Change("onChange"))
60.    )
61.)
62. 
63.    function onEditPlanGrid(e) {
64. 
65.        var grid = $("#PlanGrid").data("kendoGrid");
66.        var fieldName = grid.columns[e.container.index()];
67. 
68.        console.log("this is fieldName:", fieldName)
69.        //if (fieldName === undefined) {
70.        //    e.sender.closeCell();
71.        //}
72.    }

 

How do i get the correct column name of the cell that was clicked?. Thank

 

Chinonso
Top achievements
Rank 1
 answered on 27 Sep 2017
1 answer
365 views

Hello,

I have two grids (#Grid1 and #Grid2) with a field "Column"
I need the field "Column" in the second grid to has a value less than a value from page.
According to this topic:
http://demos.telerik.com/aspnet-mvc/grid/editing-custom-validation
I just have to write "$.extend(true, kendo.ui.validator" and "a rule", but it will affect two grids
So a question sounds like: "How to write a validation rule that will affect only one grid in page?"

Georgi
Telerik team
 answered on 27 Sep 2017
1 answer
280 views

Hello,

 

In my Kendo mobile app in MobileLayout Header i want a Dropdown menu on right handside. To achieve this i am using MobileNavBar in Header and tried to put a menu inside. But it does not work. In attached Picture i have used a MobileButton inside navbar with 3 horizontal bar. So it Looks ok. Now when clicking on this button i want a Dropdown menu. is it achievable? If yes how. Here is my code so far

@(Html.Kendo().MobileView()
.Name("Adressen")
.Stretch(true)
.Layout("mobile-tabstrip")
.Content(@<text>
@AdressGrid()
</text>)
)

@(Html.Kendo().MobileLayout()
.Name("mobile-tabstrip")
.Header(obj => NavBarTemplate(this))
.Footer(
@<text>
@(Html.Kendo().MobileTabStrip()
.Items(items =>
{
items.Add().Text("Adresse").HtmlAttributes(new { @data_icon = "vendor-e" });
items.Add().Text("Sms").HtmlAttributes(new { @data_icon = "share" });
items.Add().Text("Detail").HtmlAttributes(new { @data_icon = "home" });
items.Add().Text("Home").HtmlAttributes(new { @data_icon = "home"});
items.Add().Text("Home").HtmlAttributes(new { @data_icon = "gps-e" });
})
)
</text>)
)

@helper NavBarTemplate(WebViewPage page)
{
@(Html.Kendo().MobileNavBar()
.Content(navbar =>
@<text>
@navbar.ViewTitle("Adressen")
@(Html.Kendo().MobileButton()
.Align(MobileButtonAlign.Right)
.HtmlAttributes(new { @class = "nav-button" ,@data_icon = "arrow-e"})
.Text(""))
</text>)
)

}

Thanks

 

Anamika

 

Veselin Tsvetanov
Telerik team
 answered on 27 Sep 2017
1 answer
1.0K+ views

Hi,

I want to use Grid ForeignKey column to choose objects by id.

The sample is in attachment. I want to make school column and grade column nullable, and I can set the value to null when I edit the row.

How to do this?

 

If I want to choose school column value by typing characters for filtering, is it possible to do this in Grid ForeignKey column? Or I have to use ClientTemplate to solve this problem? 

 

Because the sample file exceed the maximum size, I removed Telerik js/css files from the sample, please use version 2017.3.913

 

Georgi
Telerik team
 answered on 26 Sep 2017
2 answers
1.1K+ views

How to include image inside header & footer template for a grid when exporting to PDF and Excel.

The Image should only be displayed in the exported files and not in the webpage.
How to implement this in both JavaScript and ASP MVC?

Yanesh
Top achievements
Rank 1
 answered on 26 Sep 2017
2 answers
785 views

Hello,

Is there a way to filter the grid directly while typing without the need to hit the enter key?

For example when i type "b" in the name search box the grid show me all products with a "b" in it.

I couldn't find documentation regarding the possibility about this.

Thank you.

Analyz-it
Top achievements
Rank 1
 answered on 26 Sep 2017
2 answers
318 views

I have a FlatColorPicker nested inside of a Kendo PanelBar that is not behaving. It is typically NOT visible when the page renders because it is inside a collapsed panel of the PanelBar. At this point it is acceptable except that the slider on the bottom only fills half of the full width of the picker, but it does work. After my "Save" js function for the page runs, the slider disappears leaving on the round slider handle.

 

@(Html.Kendo().FlatColorPicker()
        .Name("screen_background_color_select")
        .HtmlAttributes(new { style = "width: 245px" })
        .Value(Model.screen_background_color)
        .Events(ev => ev.Change("paletteChange"))
        .Preview(true)
        .Opacity(true)
)

 

I DO have some bootstrap styling inside the Panel but I have gone so far as to remove the FlatColorPicker from the PanelBar and bootstrap to no avail.  Still behaves the same.  I have verified that the Value string for the color is correct.

If I make the simple change to a ColorPicker, it works as it should.  I change nothing from the above code except removing the "Flat".

 

Magdalena
Telerik team
 answered on 26 Sep 2017
8 answers
2.4K+ views

I want to show/hide some columns on Kendo Grid and customize export to the excel.

Export conditions:

  • use grid filter selection
  • use grid seletected items
  • show/hide columns programaticaly

Is it possible to combine?

Is posible to export programaticaly only 5000 rows?

For export I use:

var exportFlag = false;
$("#grid").data("kendoGrid").bind("excelExport", function (e) {
if (!exportFlag) {
        e.sender.showColumn(0);
        e.preventDefault();
        exportFlag = true;
        setTimeout(function () {
            e.sender.saveAsExcel();
       });
    } else {
        e.sender.hideColumn(0);
       exportFlag = false;
    }
});

Customize excel code:

var sheet = e.workbook.sheets[0];
   for (var rowIndex = 0; rowIndex < sheet.rows.length; rowIndex++) {
       var row = sheet.rows[rowIndex];
       if (rowIndex == 0) {
           for (var cellIndex = 0; cellIndex < row.cells.length; cellIndex++) {
               row.cells[cellIndex].background = "#0070C0";
               row.cells[cellIndex].color = "#FFFFFF";
               row.cells[cellIndex].bold = true;
           }
       }
 
       if (rowIndex > 0 && rowIndex % 2 == 0) {
           for (var cellIndex = 0; cellIndex < row.cells.length; cellIndex++) {
               row.cells[cellIndex].background = "#DCE6F1";
           }
       }
   }

Stefan
Telerik team
 answered on 26 Sep 2017
1 answer
552 views

Hi Team,

Two things iam facing problem , when i have use hierarchical kendo grid.

1. How do i search grid data when i have hierarchical kendo grid. (search option in toolbox)

2. How do i place checkbox in innermost child grid ?  ex : in my case it will be grid containing ReleaseID as attached in diagram.

Help in this will be highly helpful.

 Attached is the screenshot. 

Please suggest.

Konstantin Dikov
Telerik team
 answered on 25 Sep 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
DropDownButton
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
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
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?