Telerik Forums
UI for ASP.NET MVC Forum
1 answer
152 views
I'm fairly new to MVC and the Kendo MVC extensions, and I must be missing something fairly basic here.  

I have a page with a strongly types model, which uses a Kendo Dropdown List, and two date pickers.  When the form is submitted, I do not get the selected values from server-side.

Here's my code:

Model:
public class ExportData
   {
       public DateTime startDate { get; set; }
 
       public DateTime endDate { get; set; }
 
       public string exportType { get; set; }
        
   }


Chtml:
@using Microsoft.AspNet.Identity
@using Kendo.Mvc.UI
 
@model InsulinCalculator.Models.ExportData
 
@using (Html.BeginForm("Export", "Home", FormMethod.Post))
{
    <div class="form-group">
        <label class="col-md-2 control-label" for="dtpStartDate" style="white-space:nowrap;">Start Date:</label>
        <div class="col-md-3">
            <div class="input-group">
                @(Html.Kendo()
                      .DatePickerFor(model => model.startDate)
                      .Name("dtpStartDate")
                      .Format("MM/dd/yyyy")
                      .HtmlAttributes(new { style = "width:180px" })
                )
            </div>
        </div>
    </div>
    <div class="form-group">
        <label class="col-md-2 control-label" for="dtpEndDate" style="white-space:nowrap;">End Date:</label>
        <div class="col-md-3">
            <div class="input-group">
                @(Html.Kendo()
                      .DatePickerFor(model => model.endDate)
                      .Name("dtpEndDate")
                      .Format("MM/dd/yyyy")
                      .HtmlAttributes(new { style = "width:180px" })
                )
            </div>
        </div>
    </div>
    <div class="form-group">
        <label class="col-md-2 control-label" for="exportType" style="white-space:nowrap;">Format:</label>
        <div class="col-md-3">
            @(Html.Kendo()
                  .DropDownListFor(model => model.exportType)
                  .Name("exportType")
                  .HtmlAttributes(new { style = "width:180px" })
                  .BindTo(new List<string>()
                         {
                             "Microsoft Excel (XLSX)",
                             "Microsoft Word (DOCX)",
                             "Adobe Acrobat (PDF)"
                         })
            )
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-4">
            <input type="submit" value="Export Data" class="btn btn-sm bg-purple2 pull-right">
        </div>
    </div>
}

Server-Side:
[Authorize]
[HttpPost]
public ActionResult Export(ExportData oData)
{
    Response.Write(oData.startDate + " " + oData.endDate + " " + oData.exportType);
    return View();
}

The model comes into the Export method correctly, but the only value that's populated is the exportType (which has a default selection), the two date pickers are completely empty.

I'd like to preserve the selections after the form submit in the pickers / dropdown, and, of course, have the data available to me on the server.  Like I said, I seem to be missing something basic, but can't figure out what!  Any help is appreciated.

Regards,
Alex
Alexander Popov
Telerik team
 answered on 05 Dec 2014
1 answer
200 views
I want to know if i can eliminate loading of kendo.web.js for my mvc project.
I am facing performance issues and eliminating unnecessary scripts from bundle, so i want to know whether kendo.web.js is required for mvc or not ?
Dimo
Telerik team
 answered on 04 Dec 2014
8 answers
322 views
HI, it is my first time attempting to use the asynchronous file upload method. Normally, I would use the synchronous method for smaller files. But now, I am dealing with video files, which can sometimes be bigger in size, so I want to use the asynchronous method so the user can see the progress (better user experience). I have attached my screenshots for reference.

I also am wondering, is it possible for me to use the ProgressBar in an synchronous file upload? My objective is to use Telerik 100% for my website, so as far as possible, I do not want to rely on any other external script that is not Telerik.
Dimiter Madjarov
Telerik team
 answered on 04 Dec 2014
1 answer
166 views
I have a grid with too many rows to fit on the screen. When exporting to Excel, only those rows visible on the screen are exported to the PDF page.  With exporting to Excel, I can set excel.allPages = true to save all rows to an Excel file. Is there a way to do so for exporting to PDF?

Thanks. 
Dimiter Madjarov
Telerik team
 answered on 04 Dec 2014
8 answers
343 views
Hello,

I'm trying to accomplish the following: I need an ajax enabled grid (declared with wrappers); the entities of the grid (let's say of type DocumentData) have a reference to another entity (that would be Country) .

Now, when in view mode, the grid should display the Description of the Country: this I accomplish by using the ClientTemplate of the BoundColumn.

When in edit mode, the grid should display a combobox; this combobox must be bound to the action of a controller: this gives us also filtering.

Filtering Country and saving DocumentData with the new selected data works perfect. 

The problem appears when we try to edit again: when switching the row to edit mode, the combox does not display the text (the Description property of the Country), but the Id; even so, if we delete the number in the combox, the filtering works again, and also the updating.

Below the code :

@{
    Html.Kendo()
        .Grid<Teamnet.eViza.Model.Entities.App.DocumentData>()
        .Name("gridDocumentData")
        .Columns(columns =>
        {
            columns.Bound(c => c.Id);
            columns.Bound(c => c.IssuedByAuthority);
            columns.Bound(c => c.IssuedCountry)
                       .ClientTemplate("#=(IssuedCountry == null) ? '' : IssuedCountry.roDescription #")
                       .EditorTemplateName("NomLookup");
            columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200);
        })
        .DataSource(dataSource =>
        {
            dataSource.Ajax()
               .CrudWithQueryAndDefaultCommands(
                   new Teamnet.eViza.Business.Queries.AllEntitiesOfTypeName(typeof(Teamnet.eViza.Model.Entities.App.DocumentData)),
                  "DocumentData")
               .AutomaticRefreshed();
             
            dataSource.Ajax()
                .Model(model => model.Id(a => a.Id));
            dataSource.Ajax().PageSize(10);
        })
        .ToolBar(toolbar => toolbar.Create())
        .Editable(editable => editable.Mode(GridEditMode.InLine))
        .AutoBind(true)
        .Pageable()
        .Filterable()
        .Sortable()
        .Render();
}

And, the editor template:

@model Teamnet.eViza.Model.Entities.BaseNom
 
@(Html.Kendo().ComboBoxFor(a => a)
                .DataTextField("roDescription")
                .DataValueField("Id")
                .Filter(FilterType.StartsWith)
                .HighlightFirst(true)
                .MinLength(1)
                .DataSource(dataSource =>
                            dataSource.Read(read =>
                                read.Action("Read", "NomComboBox", new { nomType = Teamnet.eViza.WebCommon.Utils.TypeUtils.FullNameWithAssembly(ViewData.ModelMetadata.ModelType) })
                            ).ServerFiltering(true))
                .SelectedIndex(0)
)

Attached you can find some pictures of the grid in view mode and edit mode.

Do you have any idea why this might happen ?

Thank you,
Bogdan
Daniel
Telerik team
 answered on 04 Dec 2014
7 answers
148 views
Where can I get the demo project source code to look into ?
I was looking for this demo: http://demos.telerik.com/aspnet-mvc/treelist/remote-data-binding.

Also we are also looking for binding the Treelist to dataTable object, which I think should be straight forward like the TreeView, correct ? 
Nikolay Rusev
Telerik team
 answered on 04 Dec 2014
2 answers
191 views
Dear all,

I am confused why my editor template doesn't work in the child grid then I used ("\\#=EditorTemplateName\\#") but it still didn't work . But if I use the editor template in the parent grid, it works. Do anyone here could help me?

Regards,

Rudy
Rosen
Telerik team
 answered on 04 Dec 2014
8 answers
1.1K+ views
Hi,

I have a couple of columns on a grid, some are editable and others are not. I want to be able to click in cell and change its value and then tab out of the cell.
Once I have tabbed out of a cell I want to be able to get that cell row and then pass that to a controller to perform a calculation and then return and update the grid. I need to pass the data item back to the controller I do not want to use the aggregates sum, count etc as my calculations are more complicated.

I have seen the following example:

http://www.telerik.com/forums/working-with-bound-data-on-client-side

But this doesn't really work as I expected, can you explain how I can achieve the above, I'm using Telerik MVC Grid. Thanks

Below is the code I'm trying to get to work.

Would it be possible to have a sample project?


@model IEnumerable<InlineEditing.Models.ProductViewModel>

  @(Html.Kendo().Grid(Model)
    .Name("gridCustom")
    .Columns(columns =>
    {
        columns.Bound(p => p.ProductID).Width(120);
        columns.Bound(p => p.ProductName).Width(400);
        columns.Bound(p => p.UnitPrice).Width(120);
        columns.Bound(p => p.UnitsInStock).Width(120);
        columns.Bound(p => p.Total).Width(120);
    })
    //.ToolBar(toolBar =>
    //    {
    //        toolBar.Create();
    //        toolBar.Save();
    //    })
    .Editable(editable => editable.Mode(GridEditMode.InCell))
    .Pageable()
    .Sortable()
    .Scrollable()
    .Navigatable()
    //.HtmlAttributes(new { style = "height:430px;" })
    .DataSource(dataSource => dataSource
        .Ajax()
        .Batch(true)
        .ServerOperation(false)
        .Events(events => events.Change("Edit"))
        .Model(model =>
        {
            model.Id(p => p.ProductID);
            model.Field(p => p.ProductID).Editable(false);
            model.Field(p => p.Total).Editable(false);
        })
        .PageSize(20)
        .Read(read => read.Action("EditingCustom_Read", "Home"))
        .Create(create => create.Action("EditingCustom_Create", "Home"))
        .Update(update => update.Action("EditingCustom_Update", "Home"))
        .Destroy(destroy => destroy.Action("EditingCustom_Destroy", "Home"))
        
    )
)



Alexander Popov
Telerik team
 answered on 04 Dec 2014
1 answer
252 views
Hi,

I having an issue setting the chart colours using. Up to 8 seems to work fine but anything over 8 stops the colours
being displayed in the right sequence. The first colour #008000 is displayed third.


mvc


.ColorHandler("setChartColour")

javascript

var idx = -1;

function setChartColour()
{
  if (idx == 9) //<------ 8 works
    idx = 0;
  else
    idx++;

  switch(idx)
  {
    case 0:
   {
     return '#008000';//<----Green
   }
   case 1:
   {
     return '#FF0000';//<---Red
   }
   case 2:
   {
     return '#0D0DFF';
   }
   case 3:
   {
     return '#993300';
   }
   case 4:
   {
     return '#9933FF';
   }
   case 5:
   {
     return '#FFCC00';
   }
   case 6:
   {
      return '#00CCFF';
   }
   case 7:
   {
     return '#5F5F5F';
   }
   case 8:
   {
     return '#FF33CC';
   }
   case 9:
   { 
     return '#FFCC00';
   }
  }//end switch
}
T. Tsonev
Telerik team
 answered on 04 Dec 2014
1 answer
200 views
Hi,

I have a grid in which I have bound the DropDownLists to data, but on one of the list, the data is a very large list of products. I don't want to load the entire list, I want to have the user type in 3 letters, then automatically load the dropdownlist and allow selection. As the user types in more, the DropDownList will have fewer products to choose between. I want to save the productID, but display Category -> Product Name. 

Is this possible?
Vladimir Iliev
Telerik team
 answered on 04 Dec 2014
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
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?