Telerik Forums
UI for ASP.NET MVC Forum
4 answers
245 views

Hi, Dear Telerik!

I migrated to a new version of Kendo UI Grid MVC for using scroll and had issue.

I'm using a hierarchical view with WebApi and with editing rows. And when wont to add a new record to  row on parents table (clicked "add new record" in the table), can't do this. "Circle of loading" starting turn and turns endlessly. 

But when added record to a parent table and in this time added a new record to a table - this works correctly!

wrong? Also, when used old version Kendo UI (2016) this option was ok. But must migrate for a new version.

Can u help me? 

Regards, Andrey.

My index.cshtml

Alex Hajigeorgieva
Telerik team
 answered on 20 Sep 2018
6 answers
1.7K+ views

I have a Telerik MVC grid in my application and a context menu set on the grid as well. When user clicks on the context menu, the action of the controller expects current row's id and some other data as a parameter. How can I pass this information to the action/controller from the context menu's item click?

The action is supposed to return a PDF file, so I can't use .Ajax in this case.

Here is code for the grid, context menu and the Action method.

public ActionResult ExportToPdf(int caseId, string caseNo)
{
    var rd = new ReportDocument();
    var server = @"SERVERNAME\SQLEXPRESS";
    var database = @"XYZ";
 
    rd.Load(Path.Combine(Server.MapPath("~/Reports"), "reportName.rpt"));
    rd.DataSourceConnections[0].SetConnection(server, database, "abc", "dbPassword");
    Response.Buffer = false;
    Response.ClearContent();
    Response.ClearHeaders();
 
    var stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
    stream.Seek(0, SeekOrigin.Begin);
    return File(stream, "application/pdf", String.Concat(caseNo,DateTime.Now.ToShortDateString(), ".pdf"));
}

 

@(Html.Kendo().Grid<IMCC.CTS.Models.CaseMasterViewModel>()
    .Name("caseSearchGrid")
    .Columns(columns =>
    {
        columns.Bound(c => c.case_number).Width(105);
        columns.Bound(c => c.note_number).Width(105);
        columns.Bound(c => c.title).Width(300);
        columns.Bound(c => c.instituion_date).Width(115);
    })
    .DataSource(dataSource => dataSource
        .Ajax()
        .Model(model => model.Id(p => p.id))
        .Read(read => read.Action("Search_Read", "Search").Data("GetSearchData"))
    )
)

 

01.@(Html.Kendo().ContextMenu()
02.    .Name("menu")
03.    .Target("#caseSearchGrid")
04.    .Filter("tr[role = 'row']")
05.    .Events(ev => { ev.Select("onSelect"); })
06.    .Orientation(ContextMenuOrientation.Vertical)
07.    .Animation(animation =>
08.    {
09.        animation.Open(open =>
10.        {
11.            open.SlideIn(SlideDirection.Down);
12.            open.Duration(250);
13.        });
14.    })
15.    .Items(items =>
16.    {
17.        items.Add().Text("Export").Action("ExportToPdf", "Search", new { caseId = 1, caseNo = " abc"}); //here grid's selected Model's id or row's id and selected row's case_number should be passed.
19.items.Add().Text("Export to PDF 2").Encoded(false).HtmlAttributes(new { id = "ExportToPdf2" }); // i can send this data through Ajax call, but that does not allow returning PDF from the action method.
20.    })
21.)
GPC
Top achievements
Rank 1
 answered on 20 Sep 2018
1 answer
169 views
How to get developer version javascript files for kendo spreadsheet
Dimitar
Telerik team
 answered on 20 Sep 2018
9 answers
535 views

 Hi,

in the doc under "define a custom No Records message"
http://www.kendoui.io/kendo-ui/aspnet-mvc/helpers/grid/configuration#no-records-template

there is written that I can use .NoRecords("Mystring") but this is not allowed (see Pictures)
and to set it like .NoRecords(n => n.Template("string HTML template, not centered")) is the non-centered method but I want to Center the message...

@(Html.Kendo().Grid<Order>()  
    .Name("Grid")
    .NoRecords("string HTML template, automatically centered")
)
Alex Hajigeorgieva
Telerik team
 answered on 19 Sep 2018
1 answer
1.9K+ views

I was implementing some "if condition" in child grid of kendo UI Grid Hierarchy using clientTemplate.when i used if condition in master grid using clientTemplate then it works fine for me. but when i use same code in child grid of of kendo UI Grid Hierarchy then showing "Invalid Template" Refference link https://demos.telerik.com/kendo-ui/grid/hierarchy

@(Html.Kendo().Grid(Model.OrderList)
                                            .Name("Grid")
                                            .Columns(columns =>
                                            {
                                                columns.Bound(p => p.OrderID).Width("50px").Sortable(false).Filterable(false).Title("<input type='checkbox' id='chkSelectAll' onchange='SelectAll();'/>").ClientTemplate("<input type='checkbox' id='orderselect_#=OrderID#' class='orderselect' value='#=OrderID#' onchange='chkOrUnchk(this)'/>");
 
                                            })
                                            .Resizable(r => r.Columns(true))
                                            //.Reorderable(r => r.Columns(true))
                                            .Selectable(selectable => selectable.Mode(GridSelectionMode.Multiple).Enabled(true))
                                            .Events(events => events.Change("Grid_OnRowSelect").DataBound("OrderGrid_OnDataBound").ColumnReorder("Grid_OnColumnReorder"))
                                            .Pageable(settings => settings.PageSizes(new int[] { 25, 50, 100, 500 }))
                                            .Sortable()
                                            .Scrollable(s => s.Virtual(false).Height("600px"))
                                            .Filterable()
                                            .ClientDetailTemplateId("childOrders")
                                            .DataSource(dataSource => dataSource
                                                        //.Server().Model(model => model.Id(p => p.OrderID))
                                                        .Ajax()
                                                        .PageSize(Model.DefaultOrderPageSize)
                                                        .Read(read => read.Action("ManageOrderLoadForGridAjax", "Order").Data("OrderSearchParameter"))
                                            )
                                    )
 
                                    <script id="childOrders" type="text/kendo-tmpl">
                                        @(Html.Kendo().Grid(new List<SMOrderNew>())
                                                .Name("grid_#=OrderID#") // template expression, to be evaluated in the master context
                                                .Columns(columns =>
                                                {
                                                    // *i want to add some condition using client template*
                                                    columns.Bound(p => p.OrderNumber).Groupable(false).Width("200px").Title("Order #").ClientTemplate("<a #if(DisplayDistribution){# class='OrderHover'#}# data-id='#= OrderID #' href='javascript:void(0);' style='float:left;' onclick='OpenOrderDetailsPopup(\"#= OrderID #\", 0);'> #=OrderNumber# </a>");
                                                    columns.Bound(p => p.BuyerUserID).Width("200px").Title("Buyer User ID").HtmlAttributes(new { style = "white-space: nowrap;" });
                                                })
                                                .Events(events => events.Change("Grid_OnRowSelect").DataBound("OrderGrid_OnDataBound").ColumnReorder("Grid_OnColumnReorder"))
                                                .DataSource(dataSource => dataSource
                                                    .Ajax()
                                                    .PageSize(100)
                                                    .Read(read => read.Action("ManageChildOrderLoadForGridAjax", "Order", new { OrderId = "#=OrderID#" }))
                                                )
                                                .Pageable()
                                                .Sortable()
                                                .ToClientTemplate()
                                        )
                                    </script>

 

 

Alex Hajigeorgieva
Telerik team
 answered on 19 Sep 2018
11 answers
636 views
I have a simple menu, but I need to add a querystring to one of the menu items.

What is the simplest way of doing this?

@(Html.Kendo().Menu()
      .Name("mainMenu")
      .Items(items => {
        items.Add().Text("Monitors").Action("Index", "Home").Items(subItems => {
          subItems.Add().Text("Monitors Requiring Admin").Action("Index", "Home");
        });
        items.Add().Text("Aliases").Action("Index", "Aliases");
      })
 )
The url for the sub item needs to have the querystring "?MonitorGrid-filter=HasBeenAdministered~eq~false" added to it as I want a pre-filtered view of the grid when the page loads.

Cheers,
Nick
Joana
Telerik team
 answered on 18 Sep 2018
3 answers
573 views

Hi.

I´m trying to build a SPA MVC ASP NET web Project which uses partsviews as a view templates kendo.  Like this:

File: Views/Home/Dashboard.cshtml.

<script id="dashboardview" type="text/x-kendo-template">

    <div class="container-fluid">
        <div class="row">
            <div class="col">

                <p>
                 @(Html.Kendo()
                .Button()
                .Name("PrimaryButton")
                .Content("Boton 1 dashboard")
                .HtmlAttributes(new { @class = "textButton k-primary" }))
  </p>
                <p>
                    @(Html.Kendo()
                .Button()
                .Name("PrimaryButton2")
                .Content("Boton 2 dashboard")
                .HtmlAttributes(new { @class = "textButton k-primary" }))

                </p>

            </div>
        </div>
    </div>

</script>

All is right when javascript router object is running, the views are created and destroyed correctly but when one of these view (kendo templates) has two or more kendo mvc controls, the render is no correctly, and de control is not render into <div id=”main”></div> how to explain your documentatio about SPA mvc Apps (Music Stored Dash Board Tutorial), like following (pay attention at <\/sctript> tag ):

<script id="dashboardview" type="text/x-kendo-template">

    <div class="container-fluid">
        <div class="row">
            <div class="col">

                <p>
                    <button class="textButton k-primary" id="PrimaryButton"> 1 dashboard</button>
                    <script>
                        kendo.syncReady(function(){jQuery("#PrimaryButton").kendoButton({});});
                    </script>
                </p>
                <p>
                    <button class="textButton k-primary" id="PrimaryButton2"> 2 dashboard</button>
                    <script>
                        kendo.syncReady(function(){jQuery("\#PrimaryButton2").kendoButton({});});
                        <\/script>

                                        </p>

                                    </div>
                                </div>
                            </div>

                    </script>

I´d tried use the ToClientTemplate() method but it doesn´t work. And the result of view is the first control, render correctly into “body app” and the second one render outside.

Please, Is there some best practice guide to Spa MVC Apps with Kendo controls? What error is it?,

Thanks in advance. I´d attached a screenshot browser

Ivan Danchev
Telerik team
 answered on 18 Sep 2018
1 answer
772 views

I was implemented kendo Grid Hierarchy in my list page. but when i list child item without client template then auto increment id of each item showing properly but when i use clientTemplate property of kendo grid in child grid to show auto increment id then only auto increment id of parent item was showing. Example showing on bellow https://demos.telerik.com/kendo-ui/grid/hierarchy

 

@(Html.Kendo().Grid(Model.OrderList)
                                        .Name("Grid")
                                        .Columns(columns =>
                                        {
                                            columns.Bound(p => p.OrderID).Width("50px").Sortable(false).Filterable(false).Title("<input type='checkbox' id='chkSelectAll' onchange='SelectAll();'/>").ClientTemplate("<input type='checkbox' id='orderselect_#=OrderID#' class='orderselect' value='#=OrderID#' onchange='chkOrUnchk(this)'/>");
 
                                        })
                                        .Resizable(r => r.Columns(true))
                                        //.Reorderable(r => r.Columns(true))
                                        .Selectable(selectable => selectable.Mode(GridSelectionMode.Multiple).Enabled(true))
                                        .Events(events => events.Change("Grid_OnRowSelect").DataBound("OrderGrid_OnDataBound").ColumnReorder("Grid_OnColumnReorder"))
                                        .Pageable(settings => settings.PageSizes(new int[] { 25, 50, 100, 500 }))
                                        .Sortable()
                                        .Scrollable(s => s.Virtual(false).Height("600px"))
                                        .Filterable()
                                        .ClientDetailTemplateId("childOrders")
                                        .DataSource(dataSource => dataSource
                                                    //.Server().Model(model => model.Id(p => p.OrderID))
                                                    .Ajax()
                                                    .PageSize(Model.DefaultOrderPageSize)
                                                    .Read(read => read.Action("ManageOrderLoadForGridAjax", "Order").Data("OrderSearchParameter"))
                                        )
                                )
 
                                Child Grid
                                <script id="childOrders" type="text/kendo-tmpl">
                                    @(Html.Kendo().Grid(new List<SMOrderNew>())
                                            .Name("grid_#=OrderID#") // template expression, to be evaluated in the master context
                                            .Columns(columns =>
                                            {
                                                // *i want child order number but return parent order number using client template*
                                                columns.Bound(p => p.OrderID).Width("50px").Sortable(false).Filterable(false).ClientTemplate("<input type='checkbox' id='orderselect_#=OrderID#' class='orderselect' value='#=OrderID#' onchange='chkOrUnchk(this)'/>");
                                                columns.Bound(p => p.OrderNumber).Groupable(false).Width("200px").Template(@<text></text>).ClientTemplate("<a #if(DisplayDistribution){# class='OrderHover'#}# data-id='#= OrderID #' href='javascript:void(0);' style='float:left;' onclick='OpenOrderDetailsPopup(\"#= OrderID #\", 0);'> #=OrderNumber# </a>");
                                                //columns.Bound(p => p.StoreName).Title("Store").Width(100).Template(@<text></text>).ClientTemplate("<div style='background:url(\"#=StoreImage_Icon#\") no-repeat left -2px; padding-left:20px;'>#=StoreName#</div>");
                                                columns.Bound(p => p.BuyerUserID).Width("200px").Title("Buyer User ID").HtmlAttributes(new { style = "white-space: nowrap;" });
                                            })
                                            .Events(events => events.Change("Grid_OnRowSelect").DataBound("OrderGrid_OnDataBound").ColumnReorder("Grid_OnColumnReorder"))
                                            .DataSource(dataSource => dataSource
                                                .Ajax()
                                                .PageSize(100)
                                                .Read(read => read.Action("ManageChildOrderLoadForGridAjax", "Order", new { OrderId = "#=OrderID#" }))
                                            )
                                            //.ClientDetailTemplateId("attributeOption")
                                            .Pageable()
                                            .Sortable()
                                            .ToClientTemplate()
                                    )
                                </script>
Dipty
Top achievements
Rank 1
 answered on 18 Sep 2018
23 answers
2.1K+ views

I have a grid which displays a summary of data along with totals and subtotals.

Each cell value has a link that enables a user to 'drill-down' to the individual records , by making a JavaScript call via a ClientTemplate.

I want to add this drill-down functionality to the sub-total rows, but I need to pass the value of the aggregating field (in my case the patient class field). However, I'm not able to reference this field in the ClientGroupFooterTemplate.

The ClientTemplate:-

 

ClientTemplate("<a href='javascript:showData(\"#= PATCLASS #\",\"#= CONSPEF #\",\"p4p\")'> #= _4p #</a>")

 

The ClientGroopFooterTemplate:-

ClientGroupFooterTemplate("<a href='javascript:showData(\"-X-\",\"-X-\",\"-X-\")'>#= sum  #</a>")

This works passing a string ("-X-" - which shows all values), but I need to pass the patient class value relating to the sub-total.  How can I do this?

Thanks

Vinod
Top achievements
Rank 1
 answered on 18 Sep 2018
9 answers
1.3K+ views

I am opening a template via the Popup Editor on a Kendo Grid.  I would like to be able to access the Model to conditionally render markup depending on the value of a property. 

Here is a partial view of the html in the template:

@Html.HiddenFor(m => m.IsCopy)
 
    <table>
        <tr><td colspan="2" align="center"><h4 class="text-info"> Pipe Details
            @{if (Model.IsCopy == true)
                {
            @Html.Label("Copy", new { id = "lblCopy", style = "display:none; color:red" })
                    }
                }
              </h4></td></tr>

</table>

When I inspect in the browser, the hidden field IsCopy is true:

<input name="IsCopy" id="IsCopy" type="hidden" value="true" data-val-required="The IsCopy field is required." data-val="true" data-bind="value:IsCopy">

But the html for Label "Copy does not render.

Carolyn
Top achievements
Rank 1
 answered on 17 Sep 2018
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?