Telerik Forums
UI for ASP.NET MVC Forum
9 answers
1.1K+ views
Is there a helper for TextBox? I tried using AutoComplete, but I think it's an over kill and it does not cache entries like Text Boxes, so it functions differently and may confuse users.

Thanks
Alex
Jim
Top achievements
Rank 1
 answered on 03 Dec 2018
1 answer
323 views

I'm trying to use the Telerik MVC TreeView control with checkboxes in a form. This form is use to create and modify my view Model to recover the user informations (in particular categories selection). 
The treeview control shows two levels. 
In case of creation, the treeview control must expand all levels.
In case of modify, the treeview control must shows the checkboxes populate in database.

How retrieve the selection of treewiew control in my view model ? I would like to retrieve the selection of treeview control in controller.

Do you have a sample code to explain that ? The demo of treewiew control doesn't explain this binding type of remote data. My treeview control is not make on demand.

My form looks like this :

@model DigitalVM

 

@using (Html.BeginForm("saveCampaign", "Digital", FormMethod.Post))
            {
                @Html.AntiForgeryToken()
                <!-- Champs cachés -->
                @Html.HiddenFor(model => Model.ID)
                <div class="row 1">
                    <div class="form-group col-xs-12 col-md-6 Libelle">
                        @Html.LabelFor(model => model.Libelle)
                        <div>
                            @(Html.Kendo().TextBoxFor(model => model.Libelle)
                                                        .HtmlAttributes(new { style = "width:100%" })
                            )
                            @Html.ValidationMessageFor(model => model.Libelle, "", new { @class = "text-danger" })
                        </div>
                    </div<!-- Libelle -->
                    <label>Categories</label>
                    <div class="form-group col-xs-12 col-md-6 Diffusion">
                        @(
                            Html.Kendo().TreeView()
                                .Name("Categories")
                                .Checkboxes(checkboxes => checkboxes
                                    //.Name("IsChecked")
                                    .CheckChildren(true)
                                )
                                .BindTo(Model.ModelTree, mappings =>
                                {
                                    mappings.For<ModelTree>(binding => binding.ItemDataBound((item, modelItem) =>
                                    {
                                        item.Id = modelItem.id;
                                        item.Text = modelItem.Name;
                                        item.Expanded = modelItem.Expanded;
                                        item.Checked = modelItem.Checked;
                                    })
                                    .Children(category => category.Children));
                                })
                                .Events(ev => ev.Check("onCheck"))
                        )
                    </div>
                </div> <!-- row 1 -->
                <div style="padding-top: 2em;">
                    <h4>Status</h4>
                    <p id="result">No nodes checked.</p>
                </div>
                <div><span class="icon icon-lock"> @PortailMR.Resources.Shared.Shared.RequiredFields</span></div>
                <div>@Html.ValidationMessage("CustomError", new { @class = "text-danger" })</div>
                <div class="form-group gbuttons">
                    <div class="k-edit-buttons text-right">
                        @*<input type="submit" value="@PortailMR.Resources.Shared.Shared.Buy.ToUpper()" title="Buy" class="icon icon-shopping-basket k-button" />*@
                        @(Html.Kendo().Button()
                            .Name("Commander")
                            .Content("Liste insertion")
                            .Icon("icon icon-next2")
                            .HtmlAttributes(new { @type = "submit", @onClick = "abortEvtUnload(true)" }))
                        @Html.ActionLink(" " + @PortailMR.Resources.Shared.Shared.Cancel, "Index", "Digital", null, new { @class = "k-button k-button-icontext k-grid-cancel", @onClick = "abortEvtUnload(true)" })
                    </div>
                </div> <!-- gbuttons -->
            }

My Controller looks like this :

[Authorize]
        [ValidateAntiForgeryToken]
        [HttpPost]
        //public ActionResult SendCommand(CommandeVM currentOffre) // OK
        public ActionResult saveCampaign(DigitalVM model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    writeLog(MethodBase.GetCurrentMethod(), "Start", "Info");
 
                    // SAVE Model in DATABASE
                    //var connectManager = ConnectManagers.FirstOrDefault(mng => mng.Product == model.Version);
 
                    return View("index");
                }
                return View("_TreeView", model);
            }
            catch (BusinessException bex)
            {
                SetModelError(MethodBase.GetCurrentMethod(), bex);
                return View("ErrorBusiness", "_Layout3", new HandleErrorInfo(bex, "Offre", "Index"));
            }

My View model looks like this :

public class ModelTree
{
    public string id { get; set; }
    public string Name { get; set; }
    public bool Checked { get; set; }
    public bool Expanded { get; set; }
    public IList<ModelTree> Children { get; set; }
    public ModelTree Parent { get; set; }
}
public class DigitalVM
{
    public int ID { get; set; }
     
    public String Libelle { get; set; }
 
    public IEnumerable<ModelTree> ModelTree { get; set; }
}

Best regards,

Steph.

Veselin Tsvetanov
Telerik team
 answered on 30 Nov 2018
1 answer
221 views

I've been fighting with a solution - I have to take a flat file, sometimes 200 mb or larger and and display that in a grid.

Stripping the data from the file is a snap using any one of several methods, but getting into a useful object the Grid can use becomes a real time-crusher.

The raw data is comma-delimited text with headers.

Is it possible to feed a csv into the grid?  If so, how?

I can't provide sample code because of security and time constraints.

The most promising approach has been query the the target file using OleDb classes including a OleDbDataReader.  Reading a 400k records file into a data table takes about 20 seconds give or take.  Applying that to a Grid just blows everything out of the water.  Virtual scrolling doesn't help.  I simply can't get a large file to display in your grid helper.

Grid for JS doesn't work any better.

 

Can the Grid actually display a datasource of that size in a reasonable amount of time?  Like less than a minute?

 

 

 

Tsvetina
Telerik team
 answered on 29 Nov 2018
3 answers
810 views

I have set up editor to use br instead of p for new line.

The problem I encounter is <br class="k-br"> tag is added in some situation whene ver the user select and apply the font as well.

 

Because of adding it automatically by the editor, when I get the editor value using value method, the line break is missing.

 

So, how can I set up not to add automatically line break with k-br class? Or how can I set up not to strip off br tag?

 

Thanks in advanced.

Kai

Marin Bratanov
Telerik team
 answered on 29 Nov 2018
9 answers
1.2K+ views

Setup: Master-Detail with TabStrip and Grid.

Inside a TabStrip item, which is inside a ClientDetailTemplate of a Grid, I need to have an editable Grid.

The Model for the ClientDetail contains 20 columns, but only three of them must be editable, so I want to put these three columns in an editable Grid. I want to display the rest of the (non-editable) columns in a <div><ul><li> setup, so I can style it in a multi column vertically setup for better readability (putting them as readonly columns inside the Grid would cause a huge horizontal layout).

Is there a way to bind the <li> #= items # </li> to the datasource that is bind to the Grid inside the TabStrip? It looks like I can only bind to the data that is in the Master that contains the ClientDetailTemplate.

The detail data inside the Grid, which is inside the TabStrip item, has its own datasource and this is working as expected. I just need to know how to bind the remaining values to some HTML.

TIA

Viktor Tachev
Telerik team
 answered on 28 Nov 2018
1 answer
151 views

We are using the grid to display forecast data.  it has about 15 rows.  In all but two rows, we are doing custom editing (launching another screen to edit values).  We use a column with our custom buttons to do launch the secondary screen.

In two of the rows, we would like to have in-line editing.  We'll use the same custom buttons to do this. However, we cannot find a way to programmatically put a row into in-line editing (EDIT MODE).  Is there a way to do this?  All we are able to do is to make the entire grid in-line editable and that is not what we desire. 

TIA! 

--- xavier

Georgi
Telerik team
 answered on 28 Nov 2018
4 answers
1.0K+ views

How can I correctly associate the label generated by Html.LabelFor() with my MVC Kendo DropDownListFor(). It seems like it should work but is not read by the screen reader, perhaps due to the hidden input field.

 

        <div class="input-block-level">
            @Html.LabelFor(m => m.BirthdayMonth, new {@class = "col-md-5 control-label"})
            <div class="col-md-3">
                @(Html.Kendo().DropDownListFor(m => m.BirthdayMonth)
                    .Name("BirthdayMonth")
                    .OptionLabel("Month")
                    .DataTextField("Text")
                    .DataValueField("Value")
                    .BindTo(new List<SelectListItem>
                    {
                        new SelectListItem {Text = "01 - Jan", Value = "1"},
                        new SelectListItem {Text = "02 - Feb", Value = "2"},

                                 [...etc...]
                        new SelectListItem {Text = "11 - Nov", Value = "11"},
                        new SelectListItem {Text = "12 - Dec", Value = "12"}
                    })
                    .HtmlAttributes(new {@class = "form-control", style = "width:100px"})
                    .Deferred()
                )
            </div>

        </div>

Thanks,

Gary Davis

Gary Davis
Top achievements
Rank 2
 answered on 27 Nov 2018
1 answer
274 views

Hello - I expect what I want to do is not supported. I that it he case, then I'll abandon this cool idea I have and not use the kendo spreadsheet.

I need a view-only mode that just shows the cells where they cannot be edited/modified. I need an admin-only mode where the entire spreadsheet control is functional.

For the view-only mode I tried the following, which does hide most of the stuff I don't want. But it requires more work to adjust heights and handle click events, at least. As it is when I do this various script errors are occurring when I click within the spreadsheet div:

    $(document).ready(function () {
        $('.k-spreadsheet-sheets-bar').hide();
        $('.k-tabstrip-wrapper').hide();
        $('.k-spreadsheet-action-bar').hide();
        $('.k-spreadsheet-scroller').hide();
        $('.k-spreadsheet-column-header').hide();
        $('.k-spreadsheet-row-header').hide();
    });

Marin Bratanov
Telerik team
 answered on 27 Nov 2018
8 answers
1.3K+ views

This is the code :

 

$("#chart").kendoChart({
            title: {
                text: "Distribution of roles per total number of articles(per selected levels)"
            },
            chartArea: {
                width: 800,
                heigth: 800,
                stack: { type: "100%" }
            },
            legend: {
                visible: true
            },
            seriesDefaults: {
                type: "column"

            },
            series: [
                {
                    name: "A",
                    //  order: 1,
                    stack: "Chart",
                    data: chart_Profiling//[76067, 0, 0]
                },
                 {
                     name: "B",
                     //  order: 2,
                     stack: "Chart",
                     data: chart_Compulsory//[14183, 0, 0]
                 },
                  {
                      name: "C",
                      // order: 3,
                      stack: "Chart",
                      data: chart_Complement//[1197, 465606, 6567]
                  },
                   {
                       name: "HWW",
                       visibleInLegend: false,
                       stack: "Chart1",
                       data: chart_Profiling_1//[76067, 0, 0]
                   },

                 {
                     name: "HWW",
                     visibleInLegend: false,
                     stack: "Chart1",
                     data: chart_Compulsory_1 //[14183, 0, 0]
                 },
                   {
                       name: "HWW",
                       visibleInLegend: false,
                       stack: "Chart1",
                       data: chart_Complement_1//[1197, 465606, 6567]
                   },
                   {
                       name: "OHA E",
                       visibleInLegend: false,
                       stack: "Chart2",
                       data: chart_Profiling_All_SomeArticles//[76067, 0, 0]
                   },

                 {
                     name: "OHA E",
                     visibleInLegend: false,
                     stack: "Chart2",
                     data: chart_Compulsory_All_SomeArticles //[14183, 0, 0]
                 },
                    {
                        name: "OHA E",
                        visibleInLegend: false,
                        stack: "Chart2",
                        data: chart_Complement_All_SomeArticles//[1197, 465606, 6567]

                    },


            ],
            seriesColors: ["rgb(214,186,114)", "rgb(197,200,203)", "rgb(170,115,80)"],

            valueAxis: {
                // majorUnit: (max7 / 10),
                //max: (max7 + (max7 / 6)),
                min: 0,
                max: max7,
                labels: {
                    template: "#= kendo.format('{0:N0}', value ) # "
                },
                line: {
                    visible: true
                }
            },
            categoryAxis: {
                categories: [Category1,Category2,Category3,Category4],
                majorGridLines: {
                    visible: true
                },
                labels: {
                    template: labelTemplate,
                    rotation: -45
                }
            },
            tooltip: {
                visible: true,
                template: "#= series.name #: #= value #"
            }
            ,
            pannable: {
                // lock: "y",
                // lock: "x"
            },
            zoomable: {
                mousewheel: {
                    //lock: "y"
                },
                selection: {
                    // lock: "y"
                }
            }
        });

    }

 

I need to show the chart as shown in uploaded image.

Stamo Gochev
Telerik team
 answered on 27 Nov 2018
1 answer
1.2K+ views

There is my table:

public class Sound
{
    [Key]
    [DatabaseGenerated(DatabaseGeneratedOption.None)]
    public Guid GUID { get; set; }
    [Display(Name = "Sound Type")]
    [Required]
    public SoundType SoundType { get; set; }
    [Display(Name = "Bandwidth, kHz")]
    public byte? Bandwidth { get; set; }
    [Display(Name= "Frequency, Hz")]
    public short? Frequency { get; set; }
    [Display(Name = "Duration, ms")]
    public short? Duration { get; set; }
    [Display(Name="Sound File")]
    public byte[] Content { get; set; }
    [Display(Name = "File Name")]
    public string FileName { get; set; }
    public Sound()
    {
        GUID = Guid.NewGuid();
    }
}

 

I just would like to show it in a grid and to be possible to upload files into the Content field and to store their names in the FileName field.

I've been trying to find out some examples of how to perform this, but almost all of them use separated steps to upload files into some directory on the server and to save the path to the file in the table then. I prefer to save the file attributes and its content as one step using Create or Update method of .

Is it possible to do it this way? Are there some examples?

Thank you.

Marin Bratanov
Telerik team
 answered on 26 Nov 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
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?