Telerik Forums
Kendo UI for jQuery Forum
3 answers
356 views
Hi there,

I have a kendo grid which binds into  a datatable (it has to bind into a datatable as I do not know which columns i am expecting)
It seems like when binding a grid to a datatable, date columns are not being recognized as dates, and rendered as strings. So no filtering, sorting or formatting, and the date is being displayed in the json string format: /Date(1348489271318)/

The mark up is as follows:
    @{ Html.Kendo().Grid(Model.GridModel)
        .Name("Grid")
        .Columns(columns =>
        {
            foreach (System.Data.DataColumn column in Model.GridModel.Columns)
            {              
                var c = columns.Bound(column.DataType, column.ColumnName).Title(column.Caption);
             
                 if (column.ColumnName == "DateAdded")
                {                   
                    c.Format("{0:dd/MM/yyyy hh:mm}");
                 }
            }
        })

Once I change the datasource into a class model, then everything works fine, the dates are rendered as dates with the correct format, filtering and sorting.

Any ideas why column of datatype date is getting rendered as a string?
Thanks
N
Trevor
Top achievements
Rank 1
 answered on 28 May 2013
1 answer
648 views

Current Kendo version being used is 2013.1.514.340.

The MultiSelect has values and can be selected. When the model is passed to the controller, the value in the model for the MultiSelect, the value is always null.

Below is the code I am using, is this code set up correctly ?

View:
@(Html.Kendo().MultiSelectFor(x => x.x2010ArchitectureModeling)
         .Name("VS2010_Architecture_and_Modeling")
         .Placeholder("Select features...")
         .BindTo(new SelectList(ViewBag.vs2010ArchitectureModeling, "Value", "Text"))
Model:
public IList<string> x2010ArchitectureModeling { get; set; }

Controller:

public ActionResult PlaceOrder(OrderFormViewViewModel model)
        {
             // model.x2010ArchitectureModeling is null here
        }

Robert
Top achievements
Rank 1
 answered on 28 May 2013
2 answers
556 views
I am having trouble changing the styling on the Select button in the upload tool.
The Upload button has taken the correct style, but the Select does not.

I have attached code samples of the css, html, and javascript, as well as a screen shot of the rendered result.

In Chrome it looks like the button has the correct styles, but they do not render on screen.
Drew Auman
Top achievements
Rank 1
 answered on 28 May 2013
1 answer
76 views
I has a grid with many column,and I set the grid overflow-x:scroll,but it seems that that the pager not to automatic lengthening when I  drag to scroller? How to make the pager  flow to right more closely?

@(Html.Kendo().Grid(Model)

      .Name("StudentGrid")

      .Columns(columns =>

      {

        columns.Bound(p => p.Name).Title("Name").Width(200);

          columns.Bound(p => p.Age).Title("Age").Width(200);

       columns.Bound(p => p.Name).Title("Name").Width(200);

          columns.Bound(p => p.Age).Title("Age").Width(200);

      columns.Bound(p => p.Name).Title("Name").Width(200);

          columns.Bound(p => p.Age).Title("Age").Width(200);

        columns.Bound(p => p.Name).Title("Name").Width(200);

          columns.Bound(p => p.Age).Title("Age").Width(200);

      })

      .Navigatable()

      .Groupable()

      .Pageable()

      .DataSource(dataSource => dataSource

                                   
.Ajax()

                                   
.PageSize(50)

                                   
.Read(read => read.Action("GetStudentImfo", "Student"))



      ).AutoBind(false)

      .Resizable(resize => resize.Columns(true)))



and the css style:

#StudentGrid {
    overflow-x: scroll;
}
Dimo
Telerik team
 answered on 28 May 2013
3 answers
147 views
My problem is that everytime i use the .Filterable it is refreshing . . 


Controller:

public partial class ApplicantController : Controller
    {
        Entities context = new Entities();

        public ActionResult Index()
        {
            return View();
        }
        public ActionResult GetApplicant([DataSourceRequest] DataSourceRequest request)
        {
                IQueryable<APPLICANT> applicants = context.APPLICANTs;
                DataSourceResult result = applicants.ToDataSourceResult(request);
                return Json(result,JsonRequestBehavior.AllowGet);
    
        }

        public ActionResult UpdateApplicant([DataSourceRequest] DataSourceRequest request, APPLICANT applicant)
        {
            var applicantToUpdate = context.APPLICANTs.First(app => app.APPLICANT_ID == applicant.APPLICANT_ID);

            TryUpdateModel(applicantToUpdate);

            context.SaveChanges();

            return Json(ModelState.ToDataSourceResult(),JsonRequestBehavior.AllowGet);
        }
        public ActionResult InsertApplicant([DataSourceRequest] DataSourceRequest request, APPLICANT addappli)
        {
            if (ModelState.IsValid)
            {
                context.APPLICANTs.Add(addappli);
                context.SaveChanges();
            }

            return Json(new[] { addappli }.ToDataSourceResult(request));
        }
}


Index : 

@using Kendo.Mvc.UI
@(Html.Kendo().Grid<_2ndApplicantKendo.Models.APPLICANT>()
    .Name("grid")
    .ToolBar(tb => tb.Create())
        .Columns(columns =>
        {
        columns.Bound(p => p.APPLICANT_LastName).Width(130);
        columns.Bound(p => p.APPLICANT_FirstName).Width(130);
        columns.Bound(p => p.APPLICANT_MiddleName).Width(130);
        columns.Bound(p => p.APPLICANT_Address).Width(130);
        columns.Bound(p => p.APPLICANT_City).Width(130);
        columns.Bound(p => p.APPLICANT_Phone).Width(160);
        columns.Bound(p => p.APPLICANT_Email).Width(160);
         columns.Command(cmd =>
          {
              cmd.Edit();
            
          });
    })
        .Filterable()
        .Groupable()
        .Pageable(page => page.Enabled(true).PageSizes(new Int32[] { 10, 20, 40 }))
        .Scrollable()
        .Editable(a => a.Mode(GridEditMode.PopUp))
        .DataSource(dataSource => dataSource.Ajax()
        .Model(model => model.Id(c => c.APPLICANT_ID))
        .Read("GetApplicant", "Applicant")
        .Update("UpdateApplicant", "Applicant" )
        .Create("InsertApplicant", "Applicant")))

           
            


Dimiter Madjarov
Telerik team
 answered on 28 May 2013
3 answers
366 views
I'm trying to learn to use the Kendo grid.
So I went to  http://demos.kendoui.com/web/grid/index.html
Where the Basic Usage shows columns First Last City Title Birthdate

And here is the code for that under index.cshtml.

@model IEnumerable<Kendo.Mvc.Examples.Models.ProductViewModel>

@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.ProductID).Groupable(false);
columns.Bound(p => p.ProductName);
columns.Bound(p => p.UnitPrice);
columns.Bound(p => p.UnitsInStock);
})
.Groupable()
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("Products_Read", "Grid"))
)
)

I'm finding your MVC docs obtuse enough without this kind of help.

Same story on Binding to remote data.
The DataSource calls an read method that isn't in the Remote_DataController.cs

I really want to love your product..  So help me out fix the documentation.

Pat NH USA
Atanas Korchev
Telerik team
 answered on 28 May 2013
6 answers
2.6K+ views
Here is what I am trying to do.
From one view I allow the user to create a new record, let's call it Employee.  When the record is created (server side) I want to be able to pass the newly created database Id so that when I display the list of Employees in a Kendo UI grid which is populated via Ajax() call; I want to "pre" select the newly created row.  

I have not seen any good example of how to do this, especially in an ASP.NET MVC environment.
Josh
Top achievements
Rank 1
 answered on 28 May 2013
0 answers
40 views
How to delete my question,I have post a new question and want to delete the old?
xi
Top achievements
Rank 1
 asked on 28 May 2013
2 answers
675 views
Hello,

Once created, many Kendo components root DOM element are wrapped under new HTML elements.  Any class of the original input will also be copied to some parent elements.

Ex:


1.<input type="text" class="MyClass" />

Notice kendo added the MyClass to the span wrapper at line #1 and #3 once the DateTimePicker is created.

1.<span class="k-widget k-datetimepicker k-header MyClass" style="width: 200px;">
2.    <span class="k-picker-wrap k-state-default">
3.        <input id="mydatetimepicker" style="width: 100%;" data-role="datetimepicker" type="text" class="k-input MyClass" role="textbox" aria-haspopup="true" aria-expanded="false" aria-disabled="false" aria-readonly="false" aria-label="Current focused date is 5/22/2013 9:50:42 AM">
4.        <span unselectable="on" class="k-select">
5.            <span unselectable="on" class="k-icon k-i-calendar" role="button" aria-controls="datetimepicker_dateview">select</span><span unselectable="on" class="k-icon k-i-clock" role="button" aria-controls="datetimepicker_timeview">select</span>
6.        </span>
7.    </span>
8.</span>

When you access the root input (line #3) with the ID, there's no problem.

1.$('#mydatetimepicker')
2.//Will return the input of line 3

However, if you want to use the class, then is getting more tricky.

1.$('.MyClass')
2.//Will return the span of line 1 and the input of line 3

As each widget (DateTimePicker, DropDownList, ComboBox...) are wrapped differently, it might be a good idea to add a class to the root input that would allow us to spot the input we are looking for?
Simon
Top achievements
Rank 1
 answered on 28 May 2013
7 answers
385 views
Hi, 
I have scrollable Kendo grid which must fill in entire browser window (currently Chrome).

I need the vertical scrollbar to be frozen (not disappear) when I scroll to the right with the horizontal scrollbar. Also the command buttons to be frozen when I scroll to the left 

Please see the attached pictures.

Thank you in advance

Shabtai
Shabtai
Top achievements
Rank 1
 answered on 28 May 2013
Narrow your results
Selected tags
Tags
Grid
General Discussions
Charts
Data Source
Scheduler
DropDownList
TreeView
MVVM
Editor
Window
DatePicker
Spreadsheet
Upload
ListView (Mobile)
ComboBox
TabStrip
MultiSelect
AutoComplete
ListView
Menu
Templates
Gantt
Validation
TreeList
Diagram
NumericTextBox
Splitter
PanelBar
Application
Map
Drag and Drop
ToolTip
Calendar
PivotGrid
ScrollView (Mobile)
Toolbar
TabStrip (Mobile)
Slider
Button (Mobile)
Filter
SPA
Drawing API
Drawer (Mobile)
Globalization
LinearGauge
Sortable
ModalView
Hierarchical Data Source
Button
FileManager
MaskedTextBox
View
Form
NavBar
Notification
Switch (Mobile)
SplitView
ListBox
DropDownTree
PDFViewer
Sparkline
ActionSheet
TileLayout
PopOver (Mobile)
TreeMap
ButtonGroup
ColorPicker
Pager
Styling
MultiColumnComboBox
Dialog
Chat
DateRangePicker
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Effects
Accessibility
PivotGridV2
ScrollView
BulletChart
Licensing
QRCode
ResponsivePanel
Switch
Wizard
CheckBoxGroup
TextArea
Barcode
Breadcrumb
Collapsible
Localization
MultiViewCalendar
Touch
RadioButton
Stepper
Card
ExpansionPanel
Rating
RadioGroup
Badge
Captcha
Heatmap
AppBar
Loader
Security
TaskBoard
Popover
DockManager
FloatingActionButton
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
TimePicker
BottomNavigation
Ripple
SkeletonContainer
Avatar
Circular ProgressBar
FlatColorPicker
SplitButton
Signature
Chip
ChipList
VS Code Extension
AIPrompt
PropertyGrid
Sankey
Chart Wizard
OTP Input
SpeechToTextButton
InlineAIPrompt
StockChart
ContextMenu
DateTimePicker
RadialGauge
ArcGauge
AICodingAssistant
+? more
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?