Telerik Forums
UI for ASP.NET MVC Forum
3 answers
173 views

In the Editing example, (screenshot attached) if the user clicks on Add New Record, a new blank line appears at the top of the TreeList, therefore the new entry would be at the root.  How would I go about it, if I wanted to add someone under Buffy (using the sample data)?  I understand, I could have the user add a new row, then drag and drop the new value anywhere in the hierarchy, but I have a few issues with that.  First, I don't think it's a great user experience for the user to have to do that.  Secondly, and more importantly, we have business rules that don't allow people add a value to the root level.

 

I was hoping I could click on the row for Buffy, then click add and have the new row appear under Buffy's row.  Is this possible?

 

Thanks,

Mike

Viktor Tachev
Telerik team
 answered on 13 Jul 2018
2 answers
182 views

Hello Telerik,

I'm having some trouble implementing the scenario I need (not a very complex one, indeed), which is the following.

I use the Policy class as Model, which contains a Contractor property, marked with [Required] attribute. The Contractor class contains the "Id" and "Name" properties. On the View, I need to add a DropDownList which loads and displays the available contractors list (only when the user opens it), stores the selected contractor, validates it (it is mandatory), and keeps it persistently stored also when refreshing the page (e.g. after a callback which notifies failed validations on the page).

On the View I added:

<td>
    @(Html.Kendo ( ).DropDownListFor ( model => model.Contractor )
      .DataTextField ( "Name" )
      .DataValueField ( "Id" )
      .HtmlAttributes ( new { style = "width: 200px;", id = "contractorComboBox" } )
      .AutoBind(false)
      .DataSource ( source =>
      {
          source.Read ( read => read.Action ( "searchcustomers", "customer" ) ).ServerFiltering ( true );
      } )
    )
</td>
<td>
    @Html.ValidationMessageFor(model => model.Contractor, "", new { @class = "text-danger" })
</td>

 

The SearchCustomers method on the Customer controller simply retrieves a list of available Customer instances.

With this code, the list is correctly retrieved and bound, and also the validation appears. Unfortunately, when some data is selected in the dropdown, it is not posted on the Controller (the Contractor property is null). Furthermore, when the page is refreshed, also the error message "The value '3' is invalid" appears in the validation field.

Could you please give me a hand to understand what I am doing wrong?

Thank you

Maurizio
Top achievements
Rank 1
 answered on 13 Jul 2018
1 answer
173 views

Hello,

How do we go about getting the checked items when we submit a form containing the DropDownTree?  Specifically, I'd like to get a list of checked Id values from the TreeViewItemModel.

Thanks

Plamen
Telerik team
 answered on 12 Jul 2018
1 answer
1.8K+ views

I'm trying to set the destroy command visible. I need the button turn to visible or invisible using a condition(The condition depends on the selection from a DropDownList column). The first time that grid load the button shows perfectly, but when the grid changed the visible function doesn't work, the button do not turn to visible or invisible. 

Is there any way that I can accomplish that?  Thanks

This is my code:

columns.Command(command =>
 {
     command.Destroy().Visible("ButtonDestroyVisible");
});

function ButtonDestroyVisible(dataItem) {
    return dataItem.Status.StatusId == 1;       //Set to visible when StatusId == 1
}

Viktor Tachev
Telerik team
 answered on 12 Jul 2018
1 answer
2.8K+ views

Hello,

I have a rather straightforward question.. For example when I use Kendo UI HtmlHelper to create a radio button and label:

 

@Html.Kendo().RadioButton().Name("isNotUKResident").HtmlAttributes(new { @name = "IsUKResident" }).Label("No").Value("0")

 

The rendered HTML looks like this:

 

<input name="IsUKResident" class="k-radio valid" id="isNotUKResident_0" aria-invalid="true" type="radio" value="0">

<label class="k-radio-label" for="isNotUKResident_0">No</label>

 

I want to be able to add HTML attributes to the Label tag, such as class and style. Is this achievable with the Kendo UI HtmlHelper? If so, as an example, how should I modify the Razor code above to achieve that?

 

Thanks

Eyup
Telerik team
 answered on 12 Jul 2018
3 answers
271 views

Hello
I want to create a conversation between the admin in the panel and the users on the site
Please explain how to configure Chat widget in Asp.Net Mvc

 

Bozhidar
Telerik team
 answered on 12 Jul 2018
8 answers
1.2K+ views

Hi,

[b]I need to show a message after the creation of record using ajax callback. The text of message is made in mvc controlller.[/b]

My controler is simply:

 [code]       [HttpPost]
        public ActionResult User_Create([DataSourceRequest] DataSourceRequest request, UserRoleModel model)
        {
            if (model != null && ModelState.IsValid)
                try
                {
                    new LoginCommand().CreateUserData(model, UserSession, ref myMessage);
                }
                catch (Exception exception)
                {
                    ModelState.AddModelError("", exception.Message);
                }
            return Json(new[] { model }.ToDataSourceResult(request, ModelState));
        }
[/code]

The interface in razor looks like this

[code]                @(Html.Kendo().Grid(Model).Name("UzytkownicyGrid")
                .Columns(cols =>
                {
                    cols.Bound(p => p.UserLogin).Width(150).Locked();
                    cols.Bound(p => p.UserName).Width(200);
                    //                cols.Bound(p => p.Status).Width(60);
                    cols.Bound(p => p.Active).ClientTemplate("#=Active ? 'Tak': 'NIE'#").Width(80);
                    if (WlasneCommonFunc.IsAdministrator(ViewData))
                    {
                        cols.Command(command => command.Edit().Text("edytuj")).Width(120);
                    }
                    cols.Bound(p => p.MailAddress).Width(200).ClientTemplate("#= createMailLink(MailAddress) #");
                    cols.ForeignKey(p => p.RoleId, (IEnumerable)ViewData["roles"], "IdRoli", "Summary")
                        .Title("Uprawnienia").Width(150).MinScreenWidth(900);
                    cols.Bound(p => p.Mobilephone).Width(100).MinScreenWidth(1000).ClientTemplate("#= createPhoneLink(Mobilephone) #");
                    cols.Bound(p => p.Telephone).Width(100).MinScreenWidth(1100).ClientTemplate("#= createPhoneLink(Telephone) #");
                    cols.Bound(p => p.Funkcja).Width(100).MinScreenWidth(1200);
                    cols.Bound(p => p.MailDw).Width(200).MinScreenWidth(1300).ClientTemplate("#= createMailLink(MailDw) #");
                })
                .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("UzytkownicyEdit").Window(w => w.Title("Korekta uprawnieÅ„").Width(400)))
                .Groupable()
                .Resizable(resize => resize.Columns(true))
                .Reorderable(reorder => reorder.Columns(true))
                .Sortable()
                .Filterable()
                .ToolBar(toolbar =>
                {
                    if (WlasneCommonFunc.IsAdministrator(ViewData))
                    {
                        toolbar.Create();
                    }
                })
                .Navigatable()
                .Events(e => e.Edit("uzytkownikEdit"))
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .ServerOperation(false)
                    .Model(model => model.Id(p => p.Identity))
                    .Events(events => events.Error("errorHandler"))
                    .Read("Uzytkownicy_Read", "Profil")
                    .Update("Uzytkownicy_Update", "Profil")
                    .Create("Uzytkownicy_Create", "Profil")
                    .Group(groups => groups.Add(p => p.RoleId))
                    ))
[/code]

With displaying errors I have no problems.They are showed by the following function

[code]function errorHandler(e) {
    if (e.status = "error") {
        var message = "OPERACJA NIEUDANA\n";
        if (e.errors) {
            $.each(e.errors, function(key, value) {
                if ('errors' in value) {
                    $.each(value.errors, function() {
                        message += this + "\n";
                    });
                }
            });
        } else
            message += e.errorThrown;
        alert(message);
    }
}
[/code]

What method is the best to do with it? Please help me out.

Regards,
Josef Jaskowiec
Rekord 

 

Greg
Top achievements
Rank 2
 answered on 11 Jul 2018
4 answers
1.0K+ views
When I navigate to the filter menu in the column menu i am unable to place my cursor in the input box... Meaning if I want to filter by "contains" and I want to type in "something", i cannot type anything in.  It wont even allow me to click on the input boxes.  Its like they are disabled or the focus is not allowed. 

Any ideas?

http://www.telerik.com/forums/kendo-ui-framework

@(Html.Kendo().Grid<DrillDownWSnapshot>()
    .Name("ReportDrillDownWSnapshotGrid")
    .Scrollable(builder => builder.Enabled(true).Height("400px"))
    .HtmlAttributes(new { @class = "cursorLink"})
    .DataSource(ds =>
        ds.Ajax().Read(r => r.Action("DrillDown", "Reports").Data("getDrillDownParameters").Type(HttpVerbs.Post)).PageSize(500)
        )                                    
    .Columns(c =>
        {
            c.Bound(a => a.AccountNumber).Title("Account Number").ClientTemplate("<input type='hidden' id='GridRowURL' value='" + Url.Action("../Workdriver/Account") + "/#=AccountId#' />#=AccountNumber#").Width(150);
            c.Bound(a => a.Product).Title("Product").Width(150);            
            c.Bound(a => a.Source).Title("Source").Width(100);
            c.Bound(a => a.Facility).Title("Facility").Width(100);
            c.Bound(a => a.AdmitDate).Title("Admit Date").Width(150).Format("{0:d}").HtmlAttributes(new { @class = "kendoGridDate" });
            c.Bound(a => a.DischargeDate).Title("Discharge Date").Width(150).Format("{0:d}").HtmlAttributes(new { @class = "kendoGridDate" });
            c.Bound(a => a.List).Title("List").Width(200);
            c.Bound(a => a.Workflow).Title("Workflow").Width(150);
            c.Bound(a => a.Queue).Title("Queue").Width(150);
            c.Bound(a => a.AccountBalance).Title("Account Balance").Width(150).Format("{0:c}").HtmlAttributes(new { @class = "kendoGridCurrency" });            
            c.Bound(a => a.ChargeIntegrityType).Title("Charge Integrity Type").Width(200);
            c.Bound(a => a.ChargeIntegrityReason).Title("Charge Integrity Reason").Width(200);
            c.Bound(a => a.AccountCodeAnomalyGrossOpportunity).Title("Account Code Anomaly Gross Opportunity").Width(300).Format("{0:c}").HtmlAttributes(new { @class = "kendoGridCurrency" });
            c.Bound(a => a.AccountMissingChargeGrossOpportunity).Title("Account Missing Charge Gross Opportunity").Width(300).Format("{0:c}").HtmlAttributes(new { @class = "kendoGridCurrency" });
            c.Bound(a => a.AccountOverchargeGrossOpportunity).Title("Account Overcharge Gross Opportunity").Width(300).Format("{0:c}").HtmlAttributes(new { @class = "kendoGridCurrency" });
            c.Bound(a => a.AccountCodeAnomalyNetOpportunity).Title("Account Code Anomaly Net Opportunity").Width(300).Format("{0:c}").HtmlAttributes(new { @class = "kendoGridCurrency" });
            c.Bound(a => a.AccountMissingChargeNetOpportunity).Title("Account Missing Charge Net Opportunity").Width(300).Format("{0:c}").HtmlAttributes(new { @class = "kendoGridCurrency" });
            c.Bound(a => a.FinancialClassCurrentMC).Title("Financial Class Current MC").Width(200);
            c.Bound(a => a.InsuranceRollupCurrentMC).Title("Insurance Rollup Current MC").Width(215);
            c.Bound(a => a.InsuranceCurrent).Title("Insurance Current").Width(225);
            c.Bound(a => a.PreviousList).Title("Previous List").Width(150);
            c.Bound(a => a.LastActivityDate).Title("Last Activity Date").Width(150).Format("{0:d}").HtmlAttributes(new { @class = "kendoGridDate" });
            c.Bound(a => a.LastActivityUser).Title("Last Activity User").Width(250);
            c.Bound(a => a.LastActivityNote).Title("Last Activity Note").Width(350);
        })   
    .Sortable(s => s.SortMode(GridSortMode.MultipleColumn))
    .Pageable(p =>
        {
            p.Input(true).Numeric(false);
            p.PageSizes(new int[] { 100, 200, 500, 1000 });
        })
    .Filterable(filterable =>
        filterable.Operators(operators => operators
            .ForString(str => str.Clear()
                .Contains("Contains")
                .DoesNotContain("Does not contain")
                .IsEqualTo("Is equal to")
                .IsNotEqualTo("Is not equal to")
                .StartsWith("Starts with")
                .EndsWith("Ends with ")                                
            )
        )
    )
    .ColumnMenu()
    .AutoBind(false)
    .Events(e => e.DataBound("OnDataBound"))
)
Tom
Top achievements
Rank 1
 answered on 11 Jul 2018
5 answers
461 views

This problem is only happening since I update to the latest version (2018.2.620) of UI for ASP.NET MVC from 2016.3.1028.  Yeah, I know - I should keep up.  But the project is in maintenance mode now.

I know this isn't likely much to go on, but I can't imagine how I'd pack the entire project and databases (or fakes thereof) and send it in, so I'm hoping something jumps out and is quite obvious.  Any help appreciated!  Even just a better idea what to look at would be good!

I have a button outside my grid for adding rows.  It triggers .addRow() as follows:

$("#EntryGrid_New").click(function () {
  $("#EntryGrid").data('kendoGrid').addRow();
});

 

When I hit that code, I get the following error:

Unhandled exception at line 26, column 9426 in http://localhost:23159/Scripts/kendo/2018.2.620/kendo.all.min.js
0x800a138f - JavaScript runtime error: Unable to get property '_move' of undefined or null reference occurred

The line it stops on in kendo.all.js is:

    if (arguments.length === 1) {
        return on.call(that, arguments[0]);
    }
    var context = that, args = slice.call(arguments);
    if (typeof args[args.length - 1] === UNDEFINED) {
        args.pop();
    }
    var callback = args[args.length - 1], events = kendo.applyEventMap(args[0], ns);
    if (support.mouseAndTouchPresent && events.search(/mouse|click/) > -1 && this[0] !== document.documentElement) {
        MouseEventNormalizer.setupMouseMute();
        var selector = args.length === 2 ? null : args[1], bustClick = events.indexOf('click') > -1 && events.indexOf('touchend') > -1;
        on.call(this, {
            touchstart: MouseEventNormalizer.muteMouse,
            touchend: MouseEventNormalizer.unMuteMouse
        }, selector, { bustClick: bustClick });
    }
    if (typeof callback === STRING) {
        context = that.data('handler');
        callback = context[callback];
        args[args.length - 1] = function (e) {
            callback.call(context, e);
        };
    }
    args[0] = events;
    on.apply(that, args);
    return that;
},

 

For completeness, here's the definition of the grid:

@(Html.Kendo().Grid<TimePlus.Models.ScheduleExceptionViewModel>()
  .Name("EntryGrid")
  .NoRecords("No exceptions found")
 
  .Columns(columns => {
    columns.Bound(model => model.ExceptionDate);
    columns.Bound(model => model.ExpectedHours).EditorTemplateName("TwoDecimals");
    columns.Command(c => { c.Edit(); c.Destroy().Text("Remove"); }).Width(250);
  })
 
  .Editable(e => e.Mode(GridEditMode.InLine))
  .Events(e => e.Edit("EntryGrid_Edit"))
 
  .DataSource(dataSource => dataSource
    .Ajax()
    .Read(read => read.Action("Schedule_EntryGrid_Read", "Management").Data("GetSelectedDateAndUser"))
    .Destroy(destroy => destroy.Action("Schedule_EntryGrid_Destroy", "Management"))
    .Update(update => update.Action("Schedule_EntryGrid_Update", "Management"))
    .Create(create => create.Action("Schedule_EntryGrid_Create", "Management"))
    .Events(e => e.Error("EntryGrid_Error"))
    .Model(model => {
      model.Id(c => c.ID);
    })
  )
)

 

Georgi
Telerik team
 answered on 11 Jul 2018
1 answer
519 views

Hi All,

I was working on a task to export to excel with 100k rows with 50 columns, but when I click on export to excel it was generating an empty excel .Kindly help me in achieving the task.

Note: This is working well for 6000 rows.

Thanks & Regards,

Sampath

 

Preslav
Telerik team
 answered on 10 Jul 2018
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
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
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
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
Bronze
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?