Telerik Forums
UI for ASP.NET MVC Forum
4 answers
281 views
I am trying to access a date field from the grid to pass to a dropdown filter read action.  However, all I get is null in the results.  If I debug, I can see the date is the long version of 1/1/2013 which is correct but the value ends up null.  What am I doing wrong?

VIEWMODEL
[Display(Name = "In Service Date")]
[DataType(DataType.Date)]
[Required]
public DateTime InServiceDate { get; set; }

VIEW  (correctly displays 01/01/2013 in the grid)
columns.Bound(p => p.InServiceDate).Format("{0:MM/dd/yyyy}").Title("Date").Width(100);
 
model.Field(p => p.InServiceDate).DefaultValue(Model.DefaultInServiceDate);

Filter for dropdown (other fields work fine but date field is always null)
function filterTaxClassBookMethods() {       
        var row = $("#TaxClassBookMethod").closest("tr");
        var grid = $("#TaxClassBookMethod").closest("[data-role=grid]").data("kendoGrid");
        var dataItem = grid.dataItem(row);
 
        var inServiceDate = dataItem.InServiceDate;
 
        return { depreciationBookID: 1002, assetClassID: dataItem.AssetTransactionCode.AssetClassID, inServiceDate: inServiceDate };
    }

Koren
Top achievements
Rank 1
 answered on 24 Mar 2015
1 answer
280 views
So for some reason with the following code my values are empty once they get to the controller. 

Anyone have any ideas why? 


Signature of controller.
Public Function UserDetail(userString As String) _

javascript code in view. 

        function openWindow() {
            var grid = $("#AjaxGrid").data("kendoGrid");
            var selectedData = grid.dataItem(grid.select());
            var stringData = JSON.stringify(selectedData);

            var window = $("#UserDetailDiv").data("kendoWindow");
            var PopUpTitle = "User Detail: ";
            
            window.setOptions({
                title: PopUpTitle,
                content: "Loading....."
            });

            $("#UserDetailDiv").data("kendoWindow").refresh({
                url: "/Inquiry/UserDetail",
                data: { userString: stringData },

                success: function (data) {
                  
                },
                error: function (xhr, textStatus, exceptionThrown) {
                    window.close();
                    alert($.parseJSON(xhr.responseText));
                }
            });
            window.open();
            window.center();
        }

Alexander Popov
Telerik team
 answered on 24 Mar 2015
1 answer
503 views
Hi, I'm trying to make a 3-level hierarchic grid. I've seen some example doing this but in my case the nested one is still dependent from the more external and I cannot access ID to populate it.
My code:

@(Html.Kendo().Grid<RateDayViewModel>()
            .Name("dayGrid")
            .Columns(columns =>
            {
              columns.Bound(o => o.Date).Format("{0:d}");
            })
               .ClientDetailTemplateId("channelTemplate")
            .DataSource(dataSource => dataSource
                .Ajax()
                .ServerOperation(false)
                .Model(model =>
                {
                  model.Id(p => p.DayID);
                })
                .PageSize(10)
                .Read(read => read.Action("ReadSummary", "Rate"))
            )
            .Pageable()
    )
<script id="channelTemplate" type="text/kendo-tmpl">
         @(Html.Kendo().Grid<RateChannelViewModel>()
            .Name("day_#=DayID#")
            .Columns(columns =>
            {
              columns.Bound(o => o.Channel.Label).Title("Channel");
            })
                        .ClientDetailTemplateId("roomTemplate")
            .DataSource(dataSource => dataSource
                .Ajax()
                .Model(model =>
                {
                    model.Id(p => p.ChannelID);
                })
                            .Read(read => read.Action("ReadChannels", "Rate", new { Day = "#=DayID#" }))
            )
            .ToClientTemplate()
    )
</script>
<script id="roomTemplate" type="text/kendo-tmpl">
         @(Html.Kendo().Grid<RateRoomViewModel>()
            .Name("room_#=DayID##=ChannelID#")
            .Columns(columns =>
            {
              columns.Bound(o => o.Room.Label).Title("Room");
            })
            .DataSource(dataSource => dataSource
                .Ajax()
                .Model(model =>
                {
                    model.Id(p => p.RoomID);
                })
                .Read(read => read.Action("ReadRooms", "Rate", new { Day = "#=DayID#", Channel = "#=ChannelID#"}))
            )
            .ToClientTemplate()
    )
</script>

In the last one (Grid Room) I cannot access DayID property. How can I accomplish this?
Daniel
Telerik team
 answered on 24 Mar 2015
1 answer
183 views
I have a grid in an MVC view, and upon a button click i am sending its DataSource info to the controller via the parameterMap() and an ajax() posting.  something like this:

function sendData() {
    var grid = $("#Grid").data("kendoGrid"),
        parameterMap = grid.dataSource.transport.parameterMap;
  
    var data = parameterMap({ sort: grid.dataSource.sort(), filter: grid.dataSource.filter(), group: grid.dataSource.group() });
    $.ajax({
        url: "/Home/UpdateCreateDelete",
        data: data,
        type: "POST",

This works great, the controller gets the datasourcerequest info.  I can use the DataSourceRequest fields to send them later on back to a view with a grid and i can initialize that grid to use the DataSourceRequest fields like this:

// note grid.autobind() set to false, so we can load upon dom ready below:
 
$(function() {
   @{ var request = TempData["request"] as DataSourceRequest;  }
    var grid = $("#mygrid").data("kendoGrid");
​  
grid.dataSource.query({
           page:  @request.Page,            // WORKS PERFECTLY!
           pagesize: @request.PageSize,      // WORKS PERFECTLY!
           filter: null,                // FAILS IF I use filter: @request.Filter
           sort:  null,                 // FAILS IF I use sort: @request.Sort
           group: null,                 // FAILS IF I use group: @request.Group 
     });
}

The problem is that the loading does not support the filters, sorts, or groups fields from the DataSourceRequest object.  How do i convert those DataSourceRequest fields into something that is in proper format for the the Grid.query() function?


Bottom line is that i want to be able to initialize my grid with the filters, sorts, and groupings that were saved from a previous DataSourceRequest.
Dimo
Telerik team
 answered on 23 Mar 2015
4 answers
190 views
Please let me know when or if the PDF417 2-D barcodes plan to be supported in UI for ASP.NET MVC or Kendo UI.  Thanks!
Daniel
Telerik team
 answered on 23 Mar 2015
1 answer
482 views
I have a foreign key column in my grid.
   columns.ForeignKey(c => c.ManagerId, (SelectList)ViewData["ManagerIdSource"]);

It sorts by the default Guid and not by the name.
Any way I can achieve this ?

If not supported, is this feature expected anytime soon from Telerik ?
Vladimir Iliev
Telerik team
 answered on 23 Mar 2015
1 answer
889 views
I am into customizing the display of kendo grid in mobile devices.

I need to know if I can achieve this.
I need to set the data-title={the corresponding header title} to each corresponding td cell in a column.

For example I need it this way.

<td data-title="Name" role="gridcell">Joe</td>

Any way I can achieve this ?
Dimiter Madjarov
Telerik team
 answered on 23 Mar 2015
2 answers
1.9K+ views
I am using the following mask for phone and zip code

@(Html.Kendo().MaskedTextBox().Name("phone_number").Mask("(999) 000-0000")

and my model is 
 [StringLength(10, MinimumLength = 10, ErrorMessageResourceName = "InvalidPhoneNumber", ErrorMessageResourceType = typeof(ErrorMessage), ErrorMessage = null)]
public string phone_number { get; set; }

I am using unobtrusive JS validation
This works fine and throws the validation error for numbers less that 10, but still persists the error message with all digits filled.

I tried setting the min length to 14(to include special characters within), but it never throws the error message by then.
Is there any workaround or is this a known bug ?
Dimo
Telerik team
 answered on 23 Mar 2015
1 answer
249 views
Hello,

We are using ASP.NET MVC controls, and we have one potential deal breaker.

When we open the HTML source off a rendered page we see the HTML code generated by the Telerik control and immediately below it we see a <script> tag with some javascript for that control. This is very bad for us, and we don't want to have javascript code mixed in the HTML.

Is there an alternative to this issue or it is just how the controls are designed?

Thank you!
Atanas Korchev
Telerik team
 answered on 23 Mar 2015
1 answer
350 views
I'm creating all of these grids in different views and many require custom edit template.  The pattern I'm having to create is a bunch of editor templates for the dropdowns.  Is there a way to reuse the editor types with different models. The answer might be no, I just don't have yet the experience with mvc and editor templates for the answer.

My limited and not realistic way would be to have the classes used for the dropdown to inherit from a "BaseDropDown" that has the text and value properties.  Then have a case statement determine which dataveiw to use when binding.


Greg
Vladimir Iliev
Telerik team
 answered on 20 Mar 2015
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
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
ColorPicker
DateRangePicker
Wizard
Security
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
SegmentedControl
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
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?