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

When I add an MVC Spreadsheet using this very simple code (in a View page of an MVC app)

@{
    ViewBag.Title = "Index";
}
 
<h2>Index</h2>
 
@{
    var path = Server.MapPath("~/Content/CSVFiles/SUNRISE06142016.csv");
    var workbook = Telerik.Web.Spreadsheet.Workbook.Load(path);
}
 
<div style="background-color: coral; width: 500px; height: 500px; border-style: double">
    @(Html.Kendo().Spreadsheet()
        .Name("spreadsheet")
        .BindTo(workbook))
</div>

The result page is not a spreadsheet, to be sure...  I've attached a screen shot of the page without the spread sheet, and then with the spreadsheet.  What gives here?

Basically what I'm wanting to do is to upload a CSV file, of any format and load it into a spreadsheet component. Ultimately this will be for users to map their CSV uploads to an object for parsing.  Each and every CSV file will most likely be different.

 

Nencho
Telerik team
 answered on 20 Jun 2016
2 answers
315 views

Is it possible to add a bootstrap badge to a tab title?

 

I want to highlight the number of records in a tab panels, which is not initially selected.  Ideally, it would be something like:-

<span class='badge'>10</span>

Where the number would come from a variable (initially from the view bag).

 

Is this possible at all?

AP
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 20 Jun 2016
2 answers
708 views

I've got a sub-grid, which needs to allow records to be inserted, dependant on a value in the parent record.

I've got an onBound handler, which gets passed the subGrid name, but what do I need to do to hide the create button in the toolbar?

The toolbar is defined here:-

@(Html.Kendo().Grid<SystemsHelpDesk.Models.View_Support_Action>()
         .Name("ActionGrid_#=LogID#")
           .Events(e => e.Edit("onEdit"))
         .Columns(columns =>
         {
             columns.Bound(o => o.ActionID).Title("ID");
             columns.Bound(o => o.ActionDate).Title("Date").Format("{0:g}");
             columns.Bound(o => o.CategoryDescription).Title("Category");
             columns.Bound(o => o.ActionDesc).Title("Details");
             columns.Bound(o => o.UserName).Title("User");
 
         })
    .ToolBar(commands => commands.Create().Text("Add Action"))
 
 
 
  .Events(e => e.DataBound(@<text> function(e){onSubBound(e,"ActionGrid_#=LogID#",#=Resolved#)}</text>))
  .Editable(editable => editable
       .Mode(GridEditMode.PopUp))
 
         .DataSource(dataSource => dataSource
 
             .Ajax()
              .Events(e => e.Error(@<text> function(e){subError(e,"ActionGrid_#=LogID#")} </text>).Sync("ActionSync"))
              .Model(m => m.Id(p => p.ActionID))
             .PageSize(10)
                             .Read(read => read.Action("RD_Actions", "Home", new { LogID = "#= LogID #" }))
                               .Create(create => create.Action("InsertAction", "Home", new { LID = "#= LogID #" }))
                   .Update(update => update.Action("UpdateAction", "Home"))
                       .Destroy(delete => delete.Action("DeleteAction", "Home"))
             )
             .Pageable(p => p.Refresh(true))
 
             .ToClientTemplate()
 
   )

I can pass the Grid name and the value of the Boolean field that determines if records should be able to be added, but I'm at a loss at how to hide the button. I have tried:-

function onSubBound(e,gridName,Flag)
            {
               // alert(gridName);
                //alert(Flag);
 
                var grid = $(document.getElementById(gridName)).data("kendoGrid");
 
                $(grid).find("k-grid-toolbar").hide();
 
 
            }

But this doesn't work.

How can I hide the button when I need to?

Thanks

AP
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 20 Jun 2016
3 answers
141 views

Hello,

I use a PopupEdit Template with cascading DropDownLists and in th second DropDownList a serverfilter (see code)

the problem is, that the template is loaded on grid load and the second DropDownList does'nt work because the value of the
field $("#Fachgruppe_Version_ID").val() in the template is not set at this time...

  • how to solve this problem?
  • I know that there is a onEdit event from the grid but how to call scripts in the template?
  • what's the best way to use Javascript/JQuery in the template (View Components, partial views)?

robert

@(Html.Kendo().DropDownListFor(model => model.Fachgruppe_ID)
                                 .DataTextField("Fachgruppe")
                                 .DataValueField("Fachgruppe_ID")
                                 .BindTo((IEnumerable) ViewData["Fachgruppe"])
                                 .HtmlAttributes(new {style = "width:500px"})
                                 .CascadeFrom("Sparte_ID")
                                 )
 
                           @(Html.Kendo().DropDownList()
                                 .Name("FG")
                                 .HtmlAttributes(new {style = "width:100%"})
                                 .OptionLabel("Select product...")
                                 .DataTextField("Fachgruppe")
                                 .DataValueField("Fachgruppe_ID")
                                 .DataSource(source =>
                                 {
                                     source.Read(read =>
                                     {
                                         read.Action("FachgruppeVersion_Read", "Home")
                                             .Data("filterFachgruppe");
                                     })
                                         .ServerFiltering(true);
                                 })
                                 .Enable(true)
                                 .AutoBind(false)
                                 .CascadeFrom("Sparte_ID")
                                 )
 
                           <script>
                               function filterFachgruppe() {
                                   return {                            
                                       version_id: $("#Fachgruppe_Version_ID").val()
                                   };
                               }
                           </script>

Danail Vasilev
Telerik team
 answered on 20 Jun 2016
1 answer
114 views

I have a Telerik MVC Grid and this has a popup editor for each row. The editor is configured like this:

.Editable(e => e.Mode(GridEditMode.PopUp).TemplateName("MyItemEditor"))

The "MyItemEditor" is a.cshtml file containing some controls, including a ComboBox.

I want to modify the combo box in a couple of ways:

(1) On focus it should automatically open its dropdown list of items.

(2) When the user presses the Backspace key, all the text in the combo entry field should be deleted (not just the last character).

I have managed to achieve these two things in a combo that is not inside a template, by running some jquery in the $(document).ready function to add extra events to the combo. But, when the combo is inside a template, the combo is not actually initialised until the popup is opened.

Am I tackling this in the wrong way? Is there an "OnLoaded" event of the combo that I can hook into? I can't find one.

Thanks

Veselin Tsvetanov
Telerik team
 answered on 20 Jun 2016
1 answer
274 views

I'm trying to add an exploding function to my pie chart. I've been able to locate the follow javascript code to assist from the Kendo UI documentation:

seriesClick: function(e){
          $.each(e.sender.dataSource.view(), function() {
            // Clean up exploded state
            this.explode = false;
          });

          // Disable animations
          e.sender.options.transitions = false;

          // Explode the current slice
          e.dataItem.explode = true;
          e.sender.refresh();
        }


Using the MVC version I'm call the series click with:

        .Events(events => events
            .SeriesClick("explodingPie")
        )

Along with the following Javascript:

function explodingPie(e) {
    $.each(e.sender.dataSource.view(), function() {
            this.explode = false;
          });
          e.dataItem.explode = true;
          e.sender.refresh();
        }

I'm unsure why
$.each(e.sender.dataSource.view(), function() { 
isn't working properly.

Patrick | Technical Support Engineer, Senior
Telerik team
 answered on 17 Jun 2016
3 answers
101 views

Hello

I have a very weird bug. I have a page on MVC that displays two editors and gets passed a model with the value for both editors. The model is as follows:

public class BulletinsModel
    {
        [AllowHtml]
        [Display(Name = "Some Bulletin")]
        public string SomeBulletin { get; set; }
 
        [AllowHtml]
        [Display(Name = "Other Bulletin")]
        public string OtherBulletin { get; set; }
    }

I then, defined a view which receives this view model and maps it to two kendo editors.There is also some javascript code to make a post to update the information. 

@model BulletinsModel
 
<div id="settings">
    <div class="form-horizontal">
        <div class="form-group">
            @Html.LabelFor(m => m.SomeBulletin, new { @class = "col-md-6 text-left" })
            @(Html.Kendo().EditorFor(m => m.SomeBulletin).Encode(false).Name("Some_Bulletin"))
 
            @Html.LabelFor(m => m.OtherBulletin, new { @class = "col-md-6 text-left" })
            @(Html.Kendo().EditorFor(m => m.OtherBulletin).Encode(false).Name("Other_Bulletin"))
        </div>      
    </div>
</div>

My code for my action method that renders this view is as follows (nothing fancy):

[HttpGet]
public PartialViewResult Index()
{
    ViewBag.ActiveSectionName = "Bulletins";
    var bulletinModel = GetBulletinsModel();
    return PartialView("_Bulletins",bulletinModel);          
}

However, my issue is that after hitting the Index action a couple of times, the editors become non responsive and I cannot edit the information on them. This only happens on IE, as I have not been able to replicate the issue in other browsers.

 

 

Luis
Top achievements
Rank 1
 answered on 17 Jun 2016
5 answers
68 views

On my form, I disabled dates. However, when a user manually keys in a date that is disabled, it seems to clear the input. This then gets passed on to my custom validation rules as a "" (empty string) instead of the date entered. Is there a way to prevent the datepicker from clearing its input when the user keys a disabled date in?

Sunny
Top achievements
Rank 1
 answered on 17 Jun 2016
1 answer
150 views

Hi,

I am uploading an excel file and display it into spreadsheet. I want that when i upload an excel file, i fetch the records(say: ABC Class type) from posted file and validate using fluent validation. If there are any validation failure then it will be marked on the spreadsheet.

Slav
Telerik team
 answered on 17 Jun 2016
3 answers
460 views

We have what SHOULD be a simple SSN entry field:

@Html.Kendo().MaskedTextBoxFor(model => model.SSN).Mask("000-00-0000").UnmaskOnPost(true).HtmlAttributes(new { @class = "form-control", style = "width:125px" })

The problem we're having is that if we leave some digits not filled in (i.e. - "555-33-2"), no error is thrown.  Aren't the 0s supposed to be required digits?

Also, we have a regex attribute on the field in the model, for validations when NOT using the edit form (seeds, etc.).  We're planning to disable it by adding the Html attribute @data_val = "false".  Will that prevent the maskedtextbox from doing its work?

Georgi Krustev
Telerik team
 answered on 17 Jun 2016
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?