Telerik Forums
UI for ASP.NET MVC Forum
1 answer
195 views
Hello,

We have problems with the Multiselect: the initial values ​​don’t bind the control on loading of the component.
RoutesSelected a list of type "DepotViewModel" defined in the datasource.
RouteGuids is a list of Guid type.

 @(Html.Kendo().MultiSelect()                            
.Name("RouteGuids")                             
.DataTextField("Code")                             
.DataValueField("Id")                             
.Placeholder("Select route...")
.AutoBind(true)                            
.Filter("startswith")
.MaxSelectedItems(8)
.Value(Model.RoutesSelected)
.DataSource(source => source.Read(read => read.Action("GetDepots", "Request")).ServerFiltering(false)               
)      
)

Any idea?

Thanks,
Mathieu
Petur Subev
Telerik team
 answered on 10 Dec 2013
1 answer
2.3K+ views
So I have figured out how to give a grid a default sort order and it works good...  I would like to also be able to give it a secondary sort order...  first sort is "Bill Date" and then within rows that have the same bill date, they would be sort by "CoordinationOfBenefit".

Also of note, I have enabled multisort in the .Sortable

Thanks,
Jason



@(Html.Kendo().Grid<AccountClaim>()
                        .Scrollable(s => s.Height("auto"))
                        .Name("AccountClaimsGrid")
                        .HtmlAttributes(new { @class = "cursorLink", style= "height: 200px;" })
                        .DataSource(ds => ds.Ajax()
                            .Sort(sort => sort.Add("BillDate").Descending())
                            .Read("AccountClaimsData", "Workdriver", new { ProductName = ViewBag.SelectedProduct.ProductName, AccountId = Model.Account.AccountId })
                            //.PageSize(5)
                            .Events(e => e.Change("ClaimDataSourceChanged")))
                        .Columns(c =>
                        {
                            c.Bound(f => f.AccountClaimId).Visible(false);
                            c.Bound(f => f.ClaimNumber).Title("Claim Number").Width(125);
                            c.Bound(f => f.InsuranceCode).Title("Ins Code").Width(75);
                            c.Bound(f => f.CoordinationOfBenefit).Title("COB").Width(55);
                            c.Bound(f => f.ServiceDate).Title("Service").Format("{0:d}").Width(85);
                            c.Bound(f => f.BillDate).Title("Bill").Format("{0:d}").Width(85);
                            c.Bound(f => f.ClaimStatusRollupName).Title("Status").Width(100);
                            c.Bound(f => f.ClaimAmount).Title("Claim Amount").ClientTemplate("<span style='float: right;'>#=kendo.toString(ClaimAmount,'c')#</span>").Width(115);
                            c.Bound(f => f.PaidAmount).Title("Paid Amount").ClientTemplate("<span style='float: right;'>#=kendo.toString(PaidAmount,'c')#</span>").Width(110);
                            c.Bound(f => f.AdjustmentAmount).Title("Adjustment Amount").ClientTemplate("<span style='float: right;'>#=kendo.toString(AdjustmentAmount,'c')#</span>").Width(135);
                            c.Bound(f => f.PaidAmount).Title("Patient Amount").ClientTemplate("<span style='float: right;'>#=kendo.toString(PaidAmount,'c')#</span>").Width(125);
                        })
                        .Selectable(s => s.Mode(GridSelectionMode.Single))
                        .Sortable(s => s.SortMode(GridSortMode.MultipleColumn))
                        .Groupable(g =>
                        {
                            g.Messages(m =>
                            {
                                m.Empty("Drag Column Header Here to Group");
                            }
                            );
                        }
                            )
                        .Filterable()
                        .ColumnMenu()
                        .Events(e => e.Change("ClaimSelectionChanged"))
                    )
Alexander Popov
Telerik team
 answered on 09 Dec 2013
1 answer
109 views
When I try to add some table/tr/td tags, it is displaying some lines at the end of td tags.  Attaching a sample image of how it is appearing wtihin the Kendo Grid.

Sample Code :


<script id="DetailInfo" type="text/html">
<table class="DetailReport" cellspacing="10" >
<tbody>
<tr>
<td>Audit Key:</td>
<td><input Type="TextBox" width="10" class="data" ID="auditkey" readonly value="Test"/> </td>
<td><Label ID="label5">LPI Refund ID:</Label> </td>
<td><input Type="TextBox" class="data" ID="RID" readonly value="asdf"/> </td>
<td><Label ID="label12" class="label">Report Date:</Label></td>
<td><input type="TextBox" ID="ReportDate" class="data" readonly/></td>
<td><Label ID="label13" class="label">Rfund Amt:</Label> </td>
<td><input type="TextBox" ID="refundedamount" class="data" readonly /></td>

</tr>

</tbody>
</table>
</script>
THanks
Siva

Dimo
Telerik team
 answered on 09 Dec 2013
6 answers
447 views
What I'm trying to do is I have 2 ComboBoxes that are setup in a Cascading relationship.  What I am not able to get working is that when 1 option is selected in the first ComboBox the cascaded ComboBox should ONLY allow choices from the Items list it is populated with.  When a 2nd option is selected in the first ComboBox(i.e. Other) the cascaded ComboBox should allow ANY text to be entered.

How can I achieve this?  Below is my View and Controller in question. 

VIEW:
<div class="form-group">
            @Html.LabelFor(model => model.locationCode, new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @(Html.Kendo().ComboBox()
                        .Name("locationCode")
                        .Filter(FilterType.Contains)
                        .DataTextField("Text")
                        .DataValueField("Value")
                        .BindTo(Model.Locations)
                        .Suggest(true)
                )
                @Html.ValidationMessageFor(model => model.locationCode)
            </div>
        </div>
 
        <div class="form-group">
            @Html.LabelFor(model => model.loadType, new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @(Html.Kendo().ComboBox()
                        .Name("loadType")
                        .Filter(FilterType.Contains)
                        .DataTextField("Text")
                        .DataValueField("Value")
                        .BindTo(Model.LoadTypes)
                        .Suggest(true)
                )
                @Html.ValidationMessageFor(model => model.loadType)
            </div>
        </div>
 
        <div class="form-group">
            @Html.LabelFor(model => model.loadDescrip, new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @(Html.Kendo().ComboBox()
                        .Name("loadDescription")
                        .Filter(FilterType.Contains)
                        .DataTextField("DocCode")
                        .DataValueField("DocCode")
                        .DataSource(source =>
                        {
                            source.Read(read =>
                            {
                                read.Action("GetCascadeDocumentNumbers", "DockDoor")
                                    .Data("filterLoadDescription");
                            })
                          .ServerFiltering(true);
                        })
                        .Enable(false)
                        .AutoBind(false)
                        .CascadeFrom("loadType")
                )
                <script>
                    function filterLoadDescription() {
                        return {
                            locCode: $("#locationCode").val(),
                            loadType: $("#loadType").val(),
                            docNumFilter: $("#loadDescription").data("kendoComboBox").input.val()
                        };
                    }
                </script>
                @Html.ValidationMessageFor(model => model.loadDescrip)
            </div>
        </div>
CONTROLLER:
public JsonResult GetCascadeDocumentNumbers(string locCode, string loadType, string docNumFilter)
{
    if (loadType != "OPEN" && loadType != "GENERIC")
    {
        var docNums = db.GetCurrentDocumentNumbers(locCode, loadType).AsEnumerable();
 
        if (!string.IsNullOrWhiteSpace(docNumFilter))
        {
            docNums = docNums.Where(x => x.Contains(docNumFilter));
        }
 
        return Json(docNums.Select(x => new { DocCode = x.ToString() }), JsonRequestBehavior.AllowGet);
    }
    return Json(string.Empty, JsonRequestBehavior.AllowGet);
}


Georgi Krustev
Telerik team
 answered on 09 Dec 2013
1 answer
229 views
I see the documentation using Kendo UI web, etc...   I want to use the wrappers for this instead of coding the jscript.

Any resources?
Alexander Popov
Telerik team
 answered on 09 Dec 2013
1 answer
116 views
Hello,

I use the ListView with the selectable option set to ListViewSelectionMode.Single via MVC Wrapper.
Clicking on an item and therefore changing selection doesn't fire the change event if I move the mouse (within list item borders) while clicking.

I think this behaviour can be reproduced by setting selectable option to ListViewSelectionMode.Single at this demo.
 Just click the text and move mouse pointer to hilight the text. The change event si not fired.

The event is always fired as soon as you set selection mode to ListViewSelectionMode.Multiple.

Is this a bug?
Is there a workaround (can't use multiple select)?

Thanks in advance
Dirk




Dimiter Madjarov
Telerik team
 answered on 06 Dec 2013
1 answer
114 views
Hi there,

Trying to make use of the wrappers to speed things up, but I cant find a way to add "required" to a field, since the modelbinding doesn't care about the [Required] attribute on the property.
public class TaskItem : ISchedulerEvent
{
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public int TaskItemID { get; set; }
    [Required]
    public string Title { get; set; }
    public string Description { get; set; }
    [Required]
    public DateTime Start { get; set; }
    public string StartTimezone { get; set; }
    [Required]
    public DateTime End { get; set; }
    public string EndTimezone { get; set; }
    public string RecurrenceRule { get; set; }
    public int? RecurrenceID { get; set; }
    public string RecurrenceException { get; set; }
    public bool IsAllDay { get; set; }
    public int? OwnerID { get; set; }
}
In javascript this seems easy:
schema: {
    model: {
        id: "taskID",
        fields: {
            taskID: { from: "TaskID", type: "number" },
            title: { from: "Title", validation: { required: true } }
        }
    }
}
Also, I read that servervalidation were supposed to be implemented in q3-release, but I can't get it to work.

Regards,
Pär Sandgren
Vladimir Iliev
Telerik team
 answered on 06 Dec 2013
3 answers
77 views
We are migrating our  application from Telerik MVC extension to Kendo UI.  But with Telerik legacy themes Color picker is not working. With Kendo themes this is working fine.
Alex Gyoshev
Telerik team
 answered on 06 Dec 2013
1 answer
107 views
Hi,

I have a simple grid with only the Read and Destroy actions defined for the datasource. I also have an error event handler defined. While playing around with this setup, I noticed, that the row is removed as soon as I click the destroy button, even before the controller is called. If an error occures in the controller, my error handler does, what it should, but the grid is not refreshed. Do I have to do that by myself (If so, how do i do this in the error handler?) or did I make a mistake?

My View:
@(Html.Kendo().Grid<StorageClasses>()
            .Name("StorageClassesGrid")
            .ToolBar(toolbar => toolbar.Template("<button id='btnAddSC' class='k-button'><span class='k-icon k-add'></span></button>"))
            .Columns(columns =>
            {
                columns.Command(command =>
                {
                    command.Destroy().Text(" ").HtmlAttributes(new { style = "width:14px;min-width:27px" });
                }).Width("40px;");
                columns.Bound(p => p.Name);
                columns.Bound(p => p.Remark);
            })
                .Pageable(pager => pager.Refresh(true))
                .Sortable()
                .Scrollable(s => s.Height("auto"))
                .Filterable()
                .Resizable(r => r.Columns(true))
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .ServerOperation(false)
                    .Model(model => model.Id(m => m.ID))
                    .Read(read => read.Action("GetStorageClassesByLocation", "Locations", new { LocationID = Model.ID }))
                    .Destroy(destroy => destroy.Action("StorageClass_Delete", "Locations", new { LocationID = Model.ID }))
                    .Events(e => e.Error("onGridError"))
                )
                .Events(e => e.Remove("onGridRowRemove").DataBound("resizeTabs"))
            )

Controller:
[HttpPost]
        public ActionResult StorageClass_Delete([DataSourceRequest] DataSourceRequest request, long? LocationID, StorageClasses StorageClass)
        {
            Exception exception;
 
            if (StorageClass != null && LocationID != null)
            {
                try
                {
                    if (ModelState.IsValid)
                    {
                        // delete entity in database
                        var result = _db.StorageClass_Delete(
                                    LocationID.HasValue ? LocationID.Value : 0,
                                    StorageClass.ID,
                                    ClientName,
                                    "WEB",
                                    UserName,
                                    out exception);
 
                        if (exception != null)
                        {
                            AddException(exception);
                        }
 
                        // check database action result
                        if (result != null && result.ErrorID == 0)
                        {
                            // database action successful
                            return Json(new[] { StorageClass }.ToDataSourceResult(request, ModelState));
                        }
                        else
                        {
                            ModelState.AddModelError("StorageClass_Delete", result.ErrorMessage);
                            return Json(new[] { StorageClass }.ToDataSourceResult(request, ModelState));
                        }
                    }
                }
                catch (Exception ex)
                {
                    AddException(ex);
                    ModelState.AddModelError("StorageClass_Delete", ex.Message);
                    return Json(new[] { StorageClass }.ToDataSourceResult(request, ModelState));                   
                }
            }
            ModelState.AddModelError("StorageClass_Delete", "Parameter Fehler.");
            return Json(new[] { StorageClass }.ToDataSourceResult(request, ModelState));
        }

Error Handler:
function onGridError(e) {
        var txt = "";
 
        $.each(e.errors, function (propertyName) {
            txt = txt +this.errors + " ";
        });
 
        $("#lblStatus").text(txt);
        $("#lblStatus").css('color', 'red', 'font-weight ', 'bold');
    }

Best regards

Dietmar
Alexander Popov
Telerik team
 answered on 05 Dec 2013
1 answer
268 views
Hello ,i m using Kendo grid with pop-up edit mode.I have created custom template page for pop-up window.On this template there are some comboboxes.
I want user that can input(on combo's textarea)  only from combobox's value.

E.g.:

Combobox-Values: red,yellow,green

When user fill the combobox's textarea like "RED" or "Yellow" validator message should appears and ,update button should return false such required = "required"
does on combobox.

@(Html.Kendo().ComboBox()<br>
            .Name("IDTYPE")<br>
                                    //.AutoBind(false)<br>
                         //.Events(e => e<br>
                         //               .Change("combobox_select"))<br>
                    .DataTextField("DESCRIPTION").HtmlAttributes(new { style = "width:220px", required = "required" })<br>
            .DataValueField("REFERENCEID")<br>
                                    //   .Value(Model.IDTYPEGUID.ToString()) // Initial value<br>
                                    //  .BindTo(Model.IDTYPE) <br>
                                    //.AutoBind(true)   <br>
                     .Placeholder("SELECT")<br>
<br>
                        .DataSource(source =><br>
                        {<br>
                            source.Read(read =><br>
                            {<br>
<br>
                                read.Action("GetDefinitionDetails", "Definition", new { definitionCode = "IDTYPE", addEmptyRow = false })<br>
                                    //  .Data("onAdditionalData")<br>
                                ;<br>
<br>
                            })<br>
              .ServerFiltering(true);<br>
<br>
                        }))
Alexander Popov
Telerik team
 answered on 05 Dec 2013
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
Upload
ComboBox
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
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
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
Licensing
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?