Telerik Forums
UI for ASP.NET MVC Forum
1 answer
101 views
I have a grid partial as follows:

@using (Ajax.BeginForm("DppExcpnUpdate",
"DppExcpn", new AjaxOptions
    {
        UpdateTargetId = "divDppExcpnContent"
    }))
        {       
            @(Html.Kendo().Grid(Model)
                  .Name("gridDppExcpn")
              .Columns(columns =>
              {
                  columns.Bound(item =>
item.DppExcpnUid).Hidden().Visible(false);
                  columns.Bound(p =>
p.OrglUser).Hidden().Visible(false);
                  columns.Bound(p =>
p.OrglStamp).Hidden().Visible(false);
                  columns.Bound(p =>
p.UpdtUser).Hidden().Visible(false);
                  columns.Bound(p =>
p.UpdtStamp).Hidden().Visible(false);
                  columns.Template(@<text></text>).Width(25).Title("").ClientTemplate("<div class='gridAction' param-DppExcpnUid='#=
DppExcpnUid #'></div>");
                  columns.Bound(item =>
item.EqpTyp)
                    .Title("Equipment Type")
                    .Sortable(false)
                    .Filterable(false)
                    .Width(150);
                  columns.Bound(item =>
item.DmgCd)
                    .Title("Damage Code")
                    .Sortable(false)
                    .Filterable(false)
                    .Width(120);
                  columns.Bound(item =>
item.Dscr)
                    .Title("Damage Description")
                    .Filterable(false)
                    .Sortable(false)
                    .Width(240);
                  columns.Bound(item =>
item.Rmks)
                    .Title("Remarks")
                    .Sortable(false)
                    .Filterable(false);
              })
             //.AutoBind(false)
                  .Editable(editable =>
editable.Mode(GridEditMode.InLine))
                                     .Events(e
=> e.DataBound("Mol.Mr.CONMOCodes.DppExcpn.Ux.gridDppExcpndataBound")
.Save("Mol.Mr.CONMOCodes.DppExcpn.Ux.gridDppExcpnSave"))
                 .DataSource(dataSource =>
dataSource.Ajax()
                       .Sort(sort =>
                                {
                                    sort.Add(m
=> m.LsrCode).Ascending();
                                })
                .Model(model => model.Id(p
=> p.DppExcpnUid))
                .Read(read => read.Action("DppExcpnRead",
"DppExcpn", new { lsrCode = strLsrCode }))
                                    .Create("DppExcpnCreate",
"DppExcpn")
                                    .Update("DppExcpnUpdate",
"DppExcpn")
                .Events(events =>
events.Error("Mol.Mr.CONMOCodes.DppExcpn.Ux.DppExcpnError")
.RequestEnd("Mol.Mr.CONMOCodes.DppExcpn.Ux.gridDppExcpnRequestEnd"))
             )
              .Selectable()
              .Pageable()
              .Sortable()
              .Filterable()
                  )
}

My model is like:

/// <summary>
        /// Get or set property for DmgCd property.
        /// </summary>
        /// //[Required]
        [DataMember]
        [UIHint("DmgCdEditor")]
        public string DmgCd { get; set; }

        /// <summary>
        /// Get or set property for Dscr property.
        /// </summary>
        [DataMember]
        public string Dscr { get; set; }

        /// <summary>
        /// Get or set property for Rmks property.
        /// </summary>
        [DataMember]
        //[UIHint("RemarksEditor")]
        public string Rmks { get; set; }

        /// <summary>
        /// Get or set property for EqpTyp property.
        /// </summary>
        [DataMember]
        [DisplayName("Equipment Type")]
        [UIHint("EqpTypEditor")]
        [ConcurrencyCheck]
        public string EqpTyp { get; set; }

The above editor template are :
DmgCdEditor:

@using Mol.Mr.CONMOCodes.Ux
@model string
@{
    MaxRepairAmtController ctrl = new MaxRepairAmtController();
    }
@(Html.Kendo().DropDownListFor(m => m)
          //.Name("DmgCd")
          .HtmlAttributes(new {style="width:99px;" })
                              .DataValueField("Value")
                                  .DataTextField("Text")
                                  .BindTo(ctrl.GetListData("DmgCd"))
)

EqpTypEditor:

@using Mol.Mr.CONMOCodes.Ux
@model string
@{
    MaxRepairAmtController ctrl = new MaxRepairAmtController();
    }
@(Html.Kendo().DropDownListFor(m => m)
          //.Name("EqpTyp")
          .HtmlAttributes(new {style="width:99px;" })
                              .DataValueField("Value")
                                  .DataTextField("Text")
                                  .BindTo(ctrl.GetListData("EqpTyp"))
)

Now the problem is:
My grid actually has 4 columns as :
Equipment Type
Damage Code
Damage Description
Remarks

Now on add/edit I am getting "Remarks" value always as null but if database already had value for the column then I can successfully edit it. Again, if I take out the editor templates from the grid partial then I am getting all the columns' values, but I can't take them out as all those are needed for my case.

Please help it is urgent. 
Petur Subev
Telerik team
 answered on 19 Mar 2013
2 answers
97 views
Here is how my code looks on a MVC app. 

<body>
    @Html.Kendo().Calendar().Name("calendarstart").Value(DateTime.Now)
    <button id="save">Set date</button>
    <script>
        $(document).ready(function () {
            $("#save").click(function () {
                var startDate = $("#calendarstart").data("kendoCalendar");
                $.post("/Home/Index", { StartDate: startDate.value() });
            });
        });
    </script>
</body>

The issue i see is that their is no tight binding like what you have on MVC view model binding. 

Jay

Petur Subev
Telerik team
 answered on 19 Mar 2013
1 answer
298 views
Hi,

In my model I have the following property:
/// <summary>
 /// Get or set property for EffDt property.
 /// </summary>
 [DataMember]
[UIHint("EffDateEditor")]
public DateTime? EffDt { get; set; }

whereas my editor template is as follows:
@model DateTime?
@(Html.Kendo().DatePickerFor(m => m).Format("dd-MMM-yyyy"))

Lastly my grid partial has the following:
columns.Bound(p => p.EffDt)
                    .Format("{0:dd-MMM-yyyy}")
                    .Title("Effective Date")
                    .Sortable(false)
                    .Filterable(false)
                    .Width(120);

Now whether I add new data or edit existing data the date column is always throwing validation error as can be seen in the attached file.

Please help this is urgent.
Vladimir Iliev
Telerik team
 answered on 19 Mar 2013
2 answers
76 views
.Clear() seems to clear all tools. Anyway to clear a single tool?
Rod
Top achievements
Rank 1
 answered on 19 Mar 2013
1 answer
72 views
The combination of a Kendo-Menu together with own <ul> Tags on the view causes render problems in Internet Explorer 8, if you hover the mouse over the first Kendo-Menu-Entry. On hovering, the view seems to be refreshed and the content is cleared. So you get an empty view.

This bug only happens in Internet Explorer 8. The only workaround I found so far is to avoid <ul> tags in the view.

@Kendo-Team: Can you reproduce the bug or do you need any additional informations?

Petur Subev
Telerik team
 answered on 19 Mar 2013
2 answers
403 views
Hi there

Architecturally I'm a tad confused, but do confess to being new to both MVVM and KendoUI, but the sell from Telerik is that Kendo UI is really easy to start implementing and that the MVC server wrappers help you out by creating javascript for you.

What I'm confused about is how to use both of these together, or even if one should. The only reference I can find anywhere is here, but it doesn't really help. I've also looked through the examples but the relationship is still not clear.

If I understand it, the MVVM framework runs in the client browser in order to abstract responsibilities but also to bind the ViewModel to the data (using 'Observable').

On the other hand, the MVC wrappers seem to create widgets which are bound to datasources.

Do these two technologies work together and if so, in what scenarios should they be used thus? What are the advantages? In some sense it appears to me as though using the MVC wrappers and binding to datasources negates the need for a client-side MVVC pattern.

Are there any simple example projects of using the MVC server wrappers and the Kendo MVVC framework, that provides a clear understanding of the benefits, please?

Thanks so much,

Paul.
Paul
Top achievements
Rank 1
 answered on 19 Mar 2013
1 answer
188 views
So is this the only way to pass the value that has been selected back to the server ...seems like way too much glue code , I have to have a hidden field, then need to use JS to fill that field etc etc

Jay

<body>
    @using (Html.BeginForm("Index", "Home", FormMethod.Post))
    {
        @Html.HiddenFor(m => m.StartDate)
 
        @(Html.Kendo().Calendar()
                  .Name("calendarStart")
                  .Value(DateTime.Now)
              )
         
        @Html.HiddenFor(m => m.EndDate)
 
        @(Html.Kendo().Calendar()
                  .Name("calendarEnd")
                  .Value(DateTime.Now)
                  )
         
        <button name="button" value="save">Save Date</button>
    }
 
    <script>
        $(document).ready(function () {
 
            var calendarStart = $("#calendarStart").data("kendoCalendar");
            $("#StartDate").val((moment(calendarStart.value()).format("YYYY-MM-DD")));
 
            calendarStart.bind("change", function (e) {
                $("#StartDate").val((moment(this.value())).format("YYYY-MM-DD"));
             
            });
 
            var calendarEnd = $("#calendarStart").data("kendoCalendar");
            $("#EndDate").val((moment(calendarEnd.value()).format("YYYY-MM-DD")));
 
            calendarEnd.bind("change", function (e) {
                $("#EndDate").val((moment(this.value())).format("YYYY-MM-DD"));
            });
 
        });
    </script>
</body>
Petur Subev
Telerik team
 answered on 19 Mar 2013
3 answers
234 views
I am using a Kendo Window for my application, and I want to remove the default Close button from the header. I am using the Clear() method, which by definition should clear out all actions. But when I run my application, the close button is still present on the window.

Here is the Razor code that builds the wondow. Notice the Actions section. Any help would be greatly appreciated! 
@(Html.Kendo().Window()
    .Name("LoadingWindow")
    .Visible(false)
    .Title("Loading...")
    .Modal(true)
    .Height(150)
    .Width(300)
    .Actions(a => a.Clear())
    .Content(@<text>
                  <div id="loading-details">Loading Data. Please wait.
                      <div id="divLoaderGif">
                          <img src="@Url.Content("~/Content/themes/ajax-loader.gif")" alt="Loading... Please wait..." />
                      </div>
                  </div>
              </text>)
)
Dimiter Madjarov
Telerik team
 answered on 19 Mar 2013
1 answer
348 views
I'm having problems to add/edit/delete rows on a grid loaded from DataTable

I have something like the following code:
@(Html.Kendo().Grid<object>()
        .HtmlAttributes(new { style = "height: 80%;" })
        .Name("grid-records")
        .Columns(columns =>
        {
            columns.LoadSettings(Model.GridColumns);
            foreach (GridColumnSettings item in Model.GridColumns)
            {
                ModelFieldDescriptor modelField = new ModelFieldDescriptor();
                modelField.Member = item.Member;
                modelField.MemberType = item.MemberType;
                modelField.DefaultValue = null;
                modelField.IsEditable = true;              
                columns.Container.DataSource.Schema.Model.Fields.Add(modelField);
            }
            //columns.Command(command => { command.Edit(); command.Destroy(); }).HtmlAttributes(new { style = "float:right;" });
            columns.Command(command => command.Custom("ViewDetails"));
        })
        .Groupable()
        .Pageable()
        .Sortable()
        .Scrollable()
        .Filterable(Web.Helpers.KendoI18n.SetGridFilterableSettings)
        //.Editable(editable => editable.Mode(GridEditMode.InLine))
        .DataSource(dataSource => dataSource
            .Ajax()
            .Events(events => events.Error("error_handler"))
            .Read(read => read.Action("GetRecords", "Records", new { currentTableId = Model.CurrentTableId }))
            //.Update(update => update.Action("UpdateRecordFromGrid", "Design"))
            //.Destroy(destroy => destroy.Action("DeleteRecordFromGrid", "Design"))
        )
    )
In the above code if I uncomment the "commented lines" .. the exception is:

"Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions." 

Could you tell me what I should do to enable CRUD operations on this case?

Thanks
Petur Subev
Telerik team
 answered on 18 Mar 2013
1 answer
134 views
Is it possible to have only create and destroy button BUT NO EDIT button shown in a grid?

I have tried not to include edit command but on addition, the update and cancel buttons are not shown.

regards
Iliana Dyankova
Telerik team
 answered on 18 Mar 2013
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
ColorPicker
DateRangePicker
Security
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
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?