Telerik Forums
UI for ASP.NET MVC Forum
5 answers
1.5K+ views

Hi,

I have two grids, second grid (child) shows up in a window by clicking on the custom button in the first grid.  the problem are I cannot transfer the required information from parent grid to the child one (for example the id of row ) and the window is initiated once not more (in order to invoke the child grid with new routevalue). I tried session to transfer id, but it does not work properly.

I followed these examples: 

http://demos.telerik.com/aspnet-mvc/grid/custom-command

http://www.telerik.com/forums/kendo-grid-on-a-kendo-window

 

in my code, first grid (parent grid) is here:

 

        @(Html.Kendo().Grid<MainPortal.Models.Tbl_Sample>()
                       .Name("GridShowSample")
                       .DataSource(dataSource => dataSource //Configure the Grid data source.
                           .Ajax() //Specify that Ajax binding is used.
                           .Model(model => model.Id(p => p.SID))
                           .PageSize(20)
                           .Read(read => read.Action("SampleRead", "Mycontroller"))
                           .Create(create => create.Action("AddNewSample", "Mycontroller", new { model = "#=MainPortal.Models.Tbl_Sample#" }))
                           .Update(update => update.Action("Edit", "Mycontroller"))
                         )
                      .Columns(columns =>
                      {
                          columns.Bound(p => p.ID).Width(130);
                          columns.Bound(p => p.SampleBirthDay).Format("{0:MM/dd/yyyy}").Width(130);
                          columns.Bound(p => p.SampleSex).ClientTemplate(
                      "#if (SampleSex == 0) { # Female # } else if (SampleSex == 1) { # Male # } else if (SampleSex == 2) { # Unknown # } #").Filterable(filterable => filterable.UI("genderFilter")).Width(130);
                          columns.Bound(p => p.SampleStatus).ClientTemplate("#=(SampleStatus == 1) ? 'Alive' : 'Dead'#").Filterable(filterable => filterable.UI("statusFilter")).Width(130);
                          columns.Bound(p => p.User).ClientTemplate("Unknown User").Width(130);
                          columns.Bound(p => p.Date).Format("{0:MM/dd/yyyy}").Width(130);
             
                          columns.Command(command => { command.Custom("ViewDetails").Text("show history").Click("showHistory"); command.Edit(); command.Custom("confirmdelete").Text("<span class=\"k-icon k-i-delete\" title=\"delete\"></span>").Click("confirmdelete"); }).Width(200);
                      })
                      .ToolBar(toolbar =>
                      {
                      toolbar.Create().Text("Add New Sample").HtmlAttributes(new { id = "AddNewSample" });
               
                      })
                     .Filterable(filterable => filterable
                         .Extra(false).Messages(m => m.Info("Items with value equal to:")
                        ))
                     .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("AddNewSample") )
                     .Pageable()
                     .Sortable()
                     .Scrollable()
                    .Events(ev => ev.FilterMenuInit("filterMenuInit"))
                    .HtmlAttributes(new { style = "height:550px" })
)
}

 

here is the window that call the Partialview of the grid and Javascript function:

 

    @{Html.Kendo().Window()
              .Name("SampleHistoryModal")
              .Content(@<text>
                    @{Html.RenderPartial("_PartialSampleHistory")}
</text>)
                .Draggable()
                .Resizable()
                .Visible(false)
                .Actions(actions => actions.Pin().Minimize().Maximize().Close())
                .Render();
    }

    <script>
        function showHistory(e) {
          
            e.preventDefault();

            var grid = $("#GridShowSample").data("kendoGrid");
            var dataItem = grid.dataItem($(e.target).closest("tr"));
   
            var SID = dataItem.MyData;
        
            $("#SampleHistoryModal").data("kendoWindow").open()
        }

    </script>

 And here is the child grid in partial view:

@(Html.Kendo().Grid
<MainPortal.Models.Tbl_Sample_History_Sel_ID_Result>
    ()
    .Name("Grid")
    .Columns(columns =>
    {
    columns.Bound(o => o.ID).Width(130);
    columns.Bound(o => o.SampleFName).Width(120);
    columns.Bound(o => o.SampleLName).Width(120);
    columns.Bound(o => o.User).ClientTemplate("Unknown User").Width(130);
    columns.Bound(o => o.Date).Format("{0:MM/dd/yyyy}").Width(130);
    })
    .Pageable()
    .Sortable()
    .Scrollable()
    .Filterable()
    
   
    .DataSource(dataSource => dataSource
                    .Ajax()    
                   .Model(model => model.Id(o => o.PhenotypeSID))
                   .Read(read => read.Action("SampleHistoryRead", "MyController",new { ID = "1234"  }))))

 

 

 

 

Preslav
Telerik team
 answered on 12 Mar 2020
5 answers
138 views

This is what my monthView looks like after grouping my events.

Each Room Cell should be longer !! ( as long as the month calendar )

How to fix it, just to look normal !?

Dimitar
Telerik team
 answered on 11 Mar 2020
1 answer
72 views

Hi guys

 

If I use

Html.Kendo().DatePickerFor(mdl => mdl.SomeDate).Events(c => c.Change(...))

 

I get a problem in Chrome 80, in that it appears blank (it does have a value in the HTML) until I choose another date from the dropdown (and then it shows)

 

If I use 

Html.Kendo().DatePicker().Name(...).Value(Model.SomeDate).HtmlAttributes(new { type = "text" }).Events(c => c.Change(...))

 

Then it looks OK but doesn't fire the events when changed with the keyboard/dropdown

 

Any pointers? (and alas I can't upgrade either; seems the stuff in nuget doesn't target 4.6.1, only 4.5.2 or core; using too recent a one (anything after v2016.2.607) installs practically all of .net core as dependency, and anything before it wont install because of missing dependencies or target framework issues

chairman-mawh
Top achievements
Rank 1
 answered on 11 Mar 2020
1 answer
234 views

I like how I can set the filterable options for the whole grid according to data type as below:

Html.Kendo().Grid<MyModel>()
.Filterable(filterable =>
    {
        filterable.Extra(false);
        filterable.Operators(o =>
        {
            o.ForString(str => str.Clear().Contains("Contains").IsEqualTo("Is equal to"));
            o.ForEnums(en => en.Clear().IsEqualTo("Is equal to"));
        });
    });

 

However, I would like to set Extra(false) for Strings and Enums, but set Extra(true) for Numbers and DateTimes. Is there a way to set the Extra() flag per data type at the grid level without having to set it for each column at the column level?

 

 

 

 

Georgi
Telerik team
 answered on 09 Mar 2020
2 answers
253 views

As we deal with internationalization of our application we are seeing odd behavior from the ComboBox in IE 11 when the Placeholder is in a language using Unicode characters.

For example, the placeholder text "Select Ingredient" in English translates to

Vælg ingrediens - Danish

Wählen Sie Ingredient - German

Seleccione Ingrediente - Spanish

Välj ingrediens - Swedish

In English and Spanish, the ComboBox loads correctly. However, in Danish, German, and Swedish the ComboBox loads into the page already open. The same thing happens if I try to convert those Unicode characters to HTML-encoded. Is there a workaround?

Chris
Top achievements
Rank 1
 answered on 09 Mar 2020
4 answers
300 views

Hallo,

I try the demo of Pie chart in my iphone, but it doesn't display correctly with the labels, some of the labels show only a small part, is it is a bugs or need some configuration in the code?, zie screenshot in attach.

Denitsa
Telerik team
 answered on 09 Mar 2020
2 answers
1.2K+ views
Hi,

I used Asynchronous Mode of the Upload component in my MVC project, how do I pass extra parameters along with [files] to server side method? My form have kendo dropdown list. I try to pass the selected value  to Save action in controller but failed to do so.  Could someone help?  Thanks.

Second parameter in below Save function should hold that value.


        public ActionResult Async_Save(IEnumerable<HttpPostedFileBase> files, string dropdownListValue)
        {
            // The Name of the Upload component is "files"
            if (files != null)
        …
        …
        }
Martin
Telerik team
 answered on 09 Mar 2020
2 answers
242 views

     I am using this:  

 

@(Html.Kendo().MultiViewCalendar().Name("calendar").Views(3).ShowViewHeader().Min(new DateTime(2020, 7, 1)).Max(new DateTime(2020, 9, 30)).Events(e => e.Change("change"))
            )

 

and I simply want to highlight/change background color of a few days in a list in my model.  Is there a simple way of doing that?

Nikolay
Telerik team
 answered on 09 Mar 2020
13 answers
1.4K+ views

Hi

I am using a grid with with a ForeignKey-column.
Grid is displaying data from a database table, column is a nullable foreign key to another database table.

The grid displays my data as expected, except the nullable foreign key column.
Column stays empty in view, but value can (and is) selected in edit mode.

Main table class is:
{ long Id, string Text, long? ForeignKeyId }

ForeignKey class is:
{ long Id, string Text }

Cannot change classes, cause they are created by EntityFramework from database.
If I do it anyway and make "long? ForeignKeyId" > "long ForeignKeyId", it will display values in grid, but cannot select null value then.

Can't find a data-option-label like in normal DropDownList as well.

So my question is, how to use a ForeignKey-Column in a grid with an intended possible null value?

Greets Robin

Angel Petrov
Telerik team
 answered on 06 Mar 2020
2 answers
729 views

Hi I have grid with inline editing when i want to click cell to update i can see my timepicker and i can select value but when i pass next cell value is disappearing and not select or changing anything
How can i solve it?

@( Html.Kendo().Grid<MockUpForeNet.Controllers.CardDetailController.Days>()
        .Name("timegrid")
         .DataSource(d => d.Ajax().Read("TimeGridBinding", "CardDetail", new { rule = rule }).Update("UpdateTime","CardDetail").Model(keys =>
    {
       keys.Id(k => k.DayId);
       keys.Field(c => c.DayName).Editable(false);
       keys.Field(c => c.DayId).Editable(false);
       keys.Field("TimeStart", typeof(string)).Editable(true);
       keys.Field("TimeEnd", typeof(string)).Editable(true);
    }).PageSize(7))
               .Columns(c =>
                {
                    c.Bound(p => p.DayId).Width(100).Title(" ").ClientTemplate("#= chk2(data) #").Sortable(false);
                    c.Bound(e => e.DayName).Width(200).Title("Day");
                    c.Bound(e => e.TimeStart).Width(200).Title("Start Time").EditorTemplateName("StartTimeEditor");
                    c.Bound(e => e.TimeEnd).Width(200).Title("End Time").EditorTemplateName("EndTimeEditor");
                })
               .ToolBar(commands =>
                {
                    commands.Save().SaveText(" ").CancelText(" ");
                })
       .Editable(editing => editing.Mode(Kendo.Mvc.UI.GridEditMode.InCell))
       .Sortable()
       .ColumnMenu()
    )     
Nikolay
Telerik team
 answered on 06 Mar 2020
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
Upload
ComboBox
MultiSelect
Window
ListView
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
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
ListView (Mobile)
Pager
Accessibility
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
MediaPlayer
TileLayout
DateInput
Drawer
SplitView
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Template
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Rating
ScrollView
ButtonGroup
CheckBoxGroup
Licensing
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
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?