Telerik Forums
UI for ASP.NET MVC Forum
3 answers
920 views
Hi Kendo Team,
I have a grid with multiple child grids. I'm having troubles trying to do checkbox selection for the grid and its child grids with the requirements: selecting one record from parent grid should select all records of its child grid and select one record of the child grid should select its parent record accordingly.
The main grid:
@(Html.Kendo().Grid<PendDetailRecordDTO>()
        .Name("pendDetailRecord_grid")
        .Columns(columns =>
        {
        columns.Bound(c => c.DetailRecord.ID).HeaderTemplate(@<input type="checkbox" id="selectAll" />)
            .ClientTemplate(@"
                                # if (StatusText=='Failed') { #
                                <input type=""checkbox"" class=""app_select"" data-refid='#: DetailRecord.ID #'/>
                                # } #
                        ").Sortable(false).Width(20);
            columns.Bound(c => c.DetailRecord.StorageLoc).Title("Storage Location").Width(105);
            columns.Bound(c => c.StorageLocationText).Title("Store Name").Sortable(false).Width(105);
            columns.Bound(c => c.DetailRecord.MainMaterialNo).Title("Main Stockcode").Sortable(true).Width(95);
            columns.Bound(c => c.DetailRecord.Qty).Title("Qty").Sortable(true).Width(35);
            columns.Bound(c => c.DetailRecord.ErrMsg).Title("Error Message").Sortable(false);
            columns.Bound(c => c.StatusText).Title("Status").Sortable(false).Width(55);
            columns.Bound(c => c.DocNo).Title("Doc No").Sortable(false).Width(75);
            columns.Bound(c => c.FileName).Title("File Name").Sortable(true).Width(250);
        }
  
            )
            .Pageable()
            .Sortable(sort => sort.AllowUnsort(false))
            .Scrollable(scr => scr.Height(400))
            .Resizable(resizable => resizable.Columns(true))
            .DataSource(dataSource =>
            dataSource.Ajax()
                .PageSize(20)
                .Batch(true)
                .ServerOperation(true)
                .Read(read => read.Action("GetPendDetailRecord", "Inventory", new { stockCode = Model.StockCode, storeID = Model.StoreID, fromDate = Model.FromDate, toDate = Model.ToDate, status = (Model.Status == null) ? string.Empty : string.Join(",", Model.Status), error = Model.Error}))
        )
        .ClientDetailTemplateId("DetailSectionTemplate")
        )
 
The child grid template:
@(Html.Kendo().Grid<PendDetailSectionDTO>()
    .Name("pendDetailSectionGrid_\\#=DetailSection.ID\\#")
    .Columns(columns =>
    {
        columns.Bound(c => c.DetailSection.ID).HeaderTemplate(@<input type="checkbox" id="selectAllSection" />)
        .ClientTemplate("\\# if (StatusText=='Failed') { \\# <input type='checkbox' class='app_select_Section' data-refid='\\#: DetailSection.ID \\#'/> \\# } \\#")
        .Sortable(false).Width(20);
        columns.Bound(c => c.DetailSection.ID).Title("ID");
        columns.Bound(c => c.DetailSection.MaterialNo).Title("Stockcode").Width(90);
        columns.Bound(c => c.DetailSection.UID).Title("UID").Sortable(false).ClientTemplate("\\#if (DetailSection.UID!=null&&DetailSection.UID!='') {\\#<a href='" + @Url.Content("~/Inventory/InventoryDetail") + "?SerialNo=\\#=DetailSection.UID\\#'>\\#=DetailSection.UID\\#</a>\\#}\\#");
        columns.Bound(c => c.DetailSection.ManufacturePartNo).Title("Part No").Width(90);
        columns.Bound(c => c.StatusText).Title("Status").Width(55);
        columns.Bound(c => c.DetailSection.ErrMsg).Title("Error Message");
    }
    )
    .Pageable()
    .DataSource(source => source.Ajax()
        .PageSize(5)
        .ServerOperation(false)
        .Read(read => read.Action("GetPendDetailSection", "Inventory", new { detailRecordId = "#=DetailRecord.ID#" }))
    )
 
Both grid models:
public class PendDetailRecordDTO
{
    public string StatusText { get; set; }
    public string StorageLocationText { get; set; }
    public string DocNo { get; set; }
    public string FileName { get; set; }
    public SAP_DetailRecord_STG DetailRecord { get; set; }
    public PendDetailRecordDTO(SAP_DetailRecord_STG detailRecord)
    {
        DetailRecord = detailRecord;
    }
}
public class PendDetailSectionDTO
{
    public string StatusText { get; set; }
    public SAP_DetailSection_STG DetailSection { get; set; }
    public PendDetailSectionDTO(SAP_DetailSection_STG detailSection)
    {
        DetailSection = detailSection;
    }
}
 
Also I'm having troubles extracting the property using
.Name("pendDetailSectionGrid_\\#=DetailSection.ID\\#")
and
data-refid='\\#: DetailSection.ID \\#'

Which throws "Invalid Template" error. Is it because the property is not of the model but of the wrapped class? But then the following works just fine:
.ClientTemplate("\\#if (DetailSection.UID!=null&&DetailSection.UID!='') {\\#<a href='" + @Url.Content("~/Inventory/InventoryDetail") + "?SerialNo=\\#=DetailSection.UID\\#'>\\#=DetailSection.UID\\#</a>\\#}\\#")
 
Thank you and regards,
Michael Pham.
Eyup
Telerik team
 answered on 25 Jan 2017
1 answer
293 views
Hi, 

I have a Grid with a DropDownList column and another TextFields with ClientTemplate. The DropDownList shows a Spinner where I can select the ID of list, and when the field lost focus, shows a text with the text field of list.

I need that when I click on column, show me the DropDownList, not a Spinner.


@(Html.Kendo().Grid(Model.Contacts)
    .Name("Contacts")
    .ToolBar(tools => tools.Create().Text("Agregar nuevo contacto"))
    .Editable(editable => editable.Mode(GridEditMode.InCell).CreateAt(GridInsertRowPosition.Bottom))
    .Columns(columns =>
    {
        columns.Bound(p => p.Name).ClientTemplate("#= Name #" +
            "<input type='hidden' name='Contacts[#= indexContactsBasic(data)#].Name' value='#= Name #' />"
        );
        columns.Bound(p => p.CellPhone).ClientTemplate("#= CellPhone #" +
            "<input type='hidden' name='Contacts[#= indexContactsBasic(data)#].CellPhone' value='#= CellPhone #' />"
        );
        columns.Bound(p => p.Email).ClientTemplate("#= Email #" +
            "<input type='hidden' name='Contacts[#= indexContactsBasic(data)#].Email' value='#= Email #' />"
        );
        columns.Bound(p => p.Occupation).ClientTemplate("#= Occupation #" +
            "<input type='hidden' name='Contacts[#= indexContactsBasic(data)#].Occupation' value='#= Occupation #' />"
        );
        columns.ForeignKey(p => p.ThirdPartyId, ViewBag.EmployeeInformationId as SelectList, "Value", "Text").Width(100);
        columns.Command(command => command.Destroy()).Width(100);
    })
    .DataSource(dataSource => dataSource
        .Ajax()
        .Model(model =>
        {
            model.Id(p => p.Id);
        })
        .ServerOperation(false)
    )
)


Regards,
Daniel
Konstantin Dikov
Telerik team
 answered on 25 Jan 2017
3 answers
403 views

Hi Team.

I'm using a onChange event to select the row in a grid. When I select a row, an event will be triggered. Also, the color of the row is changing automatically to let me know which row is selected. Now, I have a custom command column, which is a button linked with another js function. I want to achieve that when I click the button, the onChange() of this row is also triggered. Is that possible?

Konstantin Dikov
Telerik team
 answered on 24 Jan 2017
1 answer
215 views

In the example on http://docs.telerik.com/aspnet-mvc/api/Kendo.Mvc.UI.Fluent/NotificationBuilder there is an event on Click but my MVC kendo doesn't recognise this event.

Is it a documentation error?

<%= Html.Kendo().Notification()
.Name("Notification")
.Events(events =>
    events.Click("onClick"))
%>
Rumen
Telerik team
 answered on 23 Jan 2017
3 answers
112 views

 

Hi ,

Can you help let me know on building hierarchical grid when data is nested within lists. when i use EF, data will be nested list and i need to call new action method to pull hierarchical data.

Can you help me on this ?

Below is sample class structure.

Class Building

{

    int buildingId

  List < location> loc

}

class Location

{

  int buildingId

  int locationID

List<sublocation>

}

Class Sublocation

{ 

 int id

  string name

}

 

 

 

Konstantin Dikov
Telerik team
 answered on 23 Jan 2017
1 answer
124 views

Hi all,

We are using SPA pattern in parts of our application particularly around reporting. 

Our scenario is moving from a Summary View to a Detailed View - we want to re-use the data returned on the summary view (storing the Model client-side)!

Essentially we want a mix of Server-side binding and client side binding! 

If we need extra data we server bind ... using MVC wrappers.

Can anybody see any problem using both in a solution (our license allows both)

Also open to any other suggestions? 

 

Thanks in advance!

Keith. 

 

 

 

Rumen
Telerik team
 answered on 23 Jan 2017
2 answers
2.0K+ views

Hi,

I need ASP.NET MVC confirmation dialog with dialog result.

I have a command button. When the user click button, i want to show confirmation dialog and if user click YES, set function will be call.

I took a look at the examples. "Create Confirmation Dialog via Promises" is seems to fine. but it doesn't work at my IDE.

I also tried to kendo.confirm. it works but The result is empty when I click on the button for the second time

<div id="confirm"></div><script> $("#confirm").kendoConfirm({ content: "Do you accept?", messages:{ okText: "OK"}}).data("kendoConfirm").result.done(function(){console.log("User accepted"); }).fail(function(){console.log("User rejected");});</script>

 

Emin Inam
Top achievements
Rank 1
 answered on 23 Jan 2017
5 answers
978 views
I do not find any demo which show how to implement Master/Detail using two separated Grids. I found demo where Master Grid has Child grid embedded as template, while user click + icon the child grid appears inside master grid.

I would like to have child grid on the page like master grid without embedding it into master grid. I do not find such demo anywhere.  
Dimiter Madjarov
Telerik team
 answered on 23 Jan 2017
1 answer
471 views

Hello,

I'm creating an Kendo window with JavaScript and want to set the window title with a value from a Control from the
loaded Content in the refresh or activate Event - how to access Elements of the window Content?

 

$("<div id='win" + name + "' />").appendTo(document.body).kendoWindow({
        title: stitle,
        actions: ["Close"],
        draggable: false,
        resizable: false,
        modal: true,
        animation: {
            open: {
                effects: "slideIn:left",
                duration: 500
            },
            close: {
                effects: "slideIn:left",
                reverse: true,
                duration: 500
            },
        },
        visible: false,
        pinned: false,
        content: { url: surl, iframe: false },
        refresh: function (e) {
            $.validator.unobtrusive.parse("form");
        },
        activate: function(e) {
        },
        deactivate: function (e) {
            $(windowname).data("kendoWindow").destroy();
            e.sender.destroy();
        }
    });
    var window = $(windowname).data("kendoWindow");
    window.wrapper.addClass("gpdb-sidebar-window");
    window.open();
Ianko
Telerik team
 answered on 20 Jan 2017
1 answer
213 views

Is there a way to set the offset or the distance of an exploded piece of pie chart?

 

Stamo Gochev
Telerik team
 answered on 20 Jan 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?