Telerik Forums
UI for ASP.NET MVC Forum
1 answer
669 views
Hi Everyone

I want to know if someone can help me out a bit, i am trying to use the foreign key columns, which is working just fine, accept, for some reason my kendo grid shows numeric text boxes instead of comboboxes, and i have followed the examples, but with no luck could i get them right :( attached is the code i am using

@{
        Html.Kendo().Grid<EasyAssets.Model.DTO.HomologationItemDTO>()
            .Name("itemsGrid")
            .Columns(c =>
                {
                    c.Bound(e => e.HomologationItemPriceID).ClientTemplate("<input id='#=ItemPriceID#' type='checkbox'/>").Template(t => "<input id='" + t.ItemPriceID + "' type='checkbox'/>").Title("").Width(30);
                    c.Bound(e => e.ItemPriceID).Filterable(false).Visible(false);
                    c.Bound(e => e.Item);
                    c.Bound(e => e.ItemPrice).Width(120);
                    c.ForeignKey(e => e.PriorityID, (System.Collections.IEnumerable)ViewData["priorities"], "id", "datatext").Title("Priority").Width(170);
                    c.ForeignKey(e => e.StatusID, (System.Collections.IEnumerable)ViewData["statuses"], "id", "datatext").Title("Status").Width(170);
                })
            .Editable(e => e.Mode(GridEditMode.InCell))
            .Sortable()
            .Pageable()
            .Filterable()
            .Scrollable()
            .Selectable(e => e.Mode(GridSelectionMode.Multiple))
            .AutoBind(false)
            .DataSource(e =>
                e.Ajax()
                .Batch(true)
                .ServerOperation(false)
                .PageSize(7)
                .Events(g => g.Error("ItemGridError"))
                .Model(m =>
                {
                    m.Field(f => f.ItemPrice).Editable(false);
                    m.Field(f => f.Item).Editable(false);
                    m.Id(i => i.HomologationItemPriceID);
                })
                .Read(r =>
                    {
                        r.Action("GetItems", "StockInspection");
                        r.Data("GetItemGridData");
                    }
                )
            )
            .Render();
    }

ViewData gets populated like this, the ModuleViewListDTO string(for values) and long(for ID's) properties
ViewData["priorities"] = _priorities = JsonConvert.DeserializeObject<ModuleViewListDTO>(GetOrPost("get", ApiUrl + "/api/Items?lookup=Priority", "")).data;
                ViewData["statuses"] = _statuses = JsonConvert.DeserializeObject<ModuleViewListDTO>(GetOrPost("get", ApiUrl + "/api/Items?lookup=ItemStatus", "")).data;

Attached is the results



Regards
Gregory
Rosen
Telerik team
 answered on 19 Oct 2012
1 answer
829 views
Guys,

How do I set the width of the datepickerFor?

Thanks

Vik
Mk
Top achievements
Rank 1
 answered on 19 Oct 2012
0 answers
51 views

Requirements

Kendo UI Suite and Version


jQuery Version


Supported Browsers and Platforms


Components/Widgets used 



PROJECT DESCRIPTION 
[enter description here, together with step-by-step instructions on how to use the project]
Zinnia
Top achievements
Rank 1
 asked on 19 Oct 2012
0 answers
131 views
Migrate to ASP.net platform to build a better product. ASP.Net is a free web framework to build great web-based applications. The three main advantages of ASP.net are ease of development, better efficiency with master pages and the availability as well as security of the source code. ASP.Net development helps you achieve better performance, higher scalability and improved agility. ASP to ASP.net Migration will help you work on a flexible platform and will facilitate product enhancements at a later stage. If you want to build a robust and well-architected software product using the ASP.Net framework, contact us today!
Poushali
Top achievements
Rank 1
 asked on 18 Oct 2012
2 answers
972 views
I've declared a NumericTextBox using the MVC helpers, and specified a custom HTML attribute as follows:

@(Html.Kendo().NumericTextBoxFor(a => costRow.FTE)
    .Name(costRow.CostRowId + "_FTE")
    .Step(new decimal(0.5))
    .Events(e => e
        .Change("fteChanged")
        .Spin("fteChanged")
        )
    .HtmlAttributes(new { guid=costRow.CostRowId })
)

Is there any way of getting the value of the 'guid' attribute from the 'fteChanged' function in JavaScript? I've tried $(this).attr('guid') but that doesn't give me anything.
Atanas Korchev
Telerik team
 answered on 18 Oct 2012
1 answer
964 views
Hello I am using Kendo grid to edit price lists.

I am trying to edit single value in table:

@(Html.Kendo().Grid(Model).Name("PriceList")
    .Columns(columns =>
    {
        columns.Bound(p => p.Id).Hidden();
        columns.Bound(p => p.Name);
        columns.Bound(p => p.ValidFrom).Format("{0:dd.MM.yyyy h:mm:ss}");
        columns.Bound(p => p.ValidTill).Format("{0:dd.MM.yyyy h:mm:ss}");
        columns.Bound(p => p.Created).Format("{0:dd.MM.yyyy h:mm:ss}");
        columns.Bound(p => p.UserName);
        columns.Bound(p => p.FilePath);
        columns.Command(command => { command.Edit(); command.Destroy(); });
    })
    .DataSource(dataSource => dataSource.Ajax()
            .Model(model =>
            {
                model.Id(p => p.Id);
                model.Field(p => p.ValidFrom).Editable(false);
                model.Field(p => p.ValidTill).Editable(true);
                model.Field(p => p.Created).Editable(false);
                model.Field(p => p.UserName).Editable(false);
                model.Field(p => p.FilePath).Editable(false);
                model.Field(p => p.Name).Editable(false);
        })
        .Read("PriceList_Read", "Admin")       
        .Destroy("PriceList_Editing_Destroy", "Admin")
        .Update(update=>update.Action("PriceList_Editing_Update", "Admin"))
        .Events(e=>e.Error("error_handler"))
    )   
    .Editable(editable => editable.Mode(GridEditMode.InLine))
    .AutoBind(true)
)

And I am having troubles passing edited value in grid to my controller:

public ActionResult PriceList_Editing_Update([DataSourceRequest] DataSourceRequest request, PriceListViewModel model)
        {
             
                    int Id = model.Id;
                    string Name = model.Name;
                    DateTime date = model.ValidTill; // 0001 00:00:00 value all the time
          
            return View("Index", GetViewResult());
        }

I am always getting back empty datetime value (by empty I mean {1. 1. 0001 0:00:00}) same problem is with 2 other columns using DateTime property (Created and ValidFrom). Rest of the values are posted back correctly. I was trying to get those values using string DateTillStr = Request.Params["ValidTill"]; but if I check my GET in firebug I can see grid is not sending back this value inside Request it sends only NON Datetime values of my model object. Like this:

Actual  false
FilePath    D:\Projects\CPSkla\CPSkla\App_Data\Cen°k 2012_10.xlsx
Id  23
Name    Testovací ceník
User    0
User1   null
UserName    djezek

Nothing more nothing less, only these 7 attributes I am missing rest 4 from my model:

public partial class PriceListView
    {
        public int Id { get; set; }
        public int User { get; set; }
        public string Name { get; set; }
        public System.DateTime ValidFrom { get; set; }
        public System.DateTime ValidTill { get; set; }
        public string FilePath { get; set; }
        public Nullable<System.DateTime> Created { get; set; }
        public Nullable<System.DateTime> Updated { get; set; }
        public bool Actual { get; set; }
        public string UserName { get; set; }
    }


Is there some other way to post these data back? I figured out I can attach additional data to Update request but I had an issue how to identify edited row in the table in javascript function (I know how to identify selected value but not edited).

Please help me I am quite desperate.

David Ježek
ANDREW REED
Top achievements
Rank 1
 answered on 18 Oct 2012
0 answers
225 views
Hi,
Im trying the telerick mvc chart control:
<% Chart<CollectionItem<decimal?>> chart =
                                            Html.Telerik().Chart(Model.GraphData)
                                                .Name("chart")
                                                .Title(title => title
                                                    .Text(Model.GraphTitle)
                                                    .Visible(false)
                                                )
                                                .Legend(legend => legend
                                                    .Position(ChartLegendPosition.Top)
                                                    .Visible(false)
                                                )
                                                .SeriesDefaults(series =>
                                                {
                                                    series.Column().Stack(false);
                                                })
                                                .Series(series =>
                                                {
                                                    series.Column(s => s.Value)
                                                        .Name("Totalen")
                                                        .Color("#1f3975")
                                                        .Labels(labels => labels
                                                            .Margin(-6)
                                                            .Visible(true)
                                                            .Template("<#= value #>")
                                                            .Position(ChartBarLabelsPosition.OutsideEnd));
                                                })
                                                .CategoryAxis(axis => axis
                                                    .Categories(s => s.Text)
                                                    .Color("#000000")
                                                    .Labels(labels => labels.Margin(-6).Visible(true))
                                                    .MajorGridLines(majorGridLines => majorGridLines.Color("#ddd"))
                                                )
                                                .ValueAxis(axis => axis
                                                    .Numeric().Labels(labels => labels.Margin(0).Format("{0:#,##0}")).Min(0)
                                                    .MajorUnit(Model.GraphMajorUnit)
                                                    .Color("#000000")
                                                    .Labels(labels => labels.Visible(false))
                                                    .MajorGridLines(majorGridLines => majorGridLines.Color("#ddd"))
                                                                 )
                                                .Tooltip(tooltip => tooltip
                                                    .Visible(false)
                                                    .Template("<#= category #>: <#= value #>")
                                                    .Format("{0:#,##0}")
                                                )
                                                .HtmlAttributes(new { style = "width: 225px; height: 78px;" });
 
               chart.Render();
            %>


The problem is that when one of my bars, has 0 as value, i dont' see the value on the bar, it's then empty. How can i show the 0 on the bar? i tried :
.ValueAxis(axis => axis
                                                   .Numeric().Labels(labels => labels.Margin(0).Format("{0:#,##0}")).Min(0)
                                                   .MajorUnit(Model.GraphMajorUnit)
                                                   .Color("#000000")
                                                   .Labels(labels => labels.Visible(false))
                                                   .MajorGridLines(majorGridLines => majorGridLines.Color("#ddd"))
But it does not work. 
A
Top achievements
Rank 1
 asked on 18 Oct 2012
0 answers
300 views
Is it even possible to create hierarchy tables using local data with MVC Razor? Doesn't appear so. The examples don't work. I've had no trouble with any of the other Kendo controls until now and I'm pulling my hair out...
    @(Html.Kendo().Grid<TaskDTO>(Model.Tasks)
    .Name("tasksTable")
    .Columns(columns =>
    {
        columns.Bound( p => p.ID ).Width( 300 );
        columns.Bound( p => p.Name );
        columns.Bound( p => p.TaskType );
    })
    .ClientDetailTemplateId( "testTemplate" )
    .Pageable()
    .Sortable()
    .Resizable( resize => resize.Columns( true ) )
    .Events( events => events.DataBound( "dataBound" ) )
)

This all works fine without the client template, but when I add in the ClientDetailTemplateId and it's corresponding script, all the columns in the parent table shift one column to the left. DataBind is NOT being called and in fact the template is never even executed.

I was hoping something like this would work

    <script id="testTemplate" type="text/kendo-templ">
@(Html.Kendo().Grid<CustomFieldDTO>( Model.Tasks.Where( f => f.ID == Guid.Parse( "#=ID#" ) ).FirstOrDefault().CustomFields )
        .Name( "CustomTaskFields_#=ID#" )
        .Columns( columns =>
        {
            columns.Bound( q => q.PropertyID );
            columns.Bound( q => q.FieldName );
            columns.Bound( q => q.Value );
        } )
        .Pageable()
        .Sortable()
        .ToClientTemplate()
)
    </script>

but doesn't appear so.

I got it working almost working using DataSource to the controller but I need to send both the Project and Task IDs and ProjectID is not in the bound data that the template gets. I can't find anyway to pass additional data to the template.

Tag
Top achievements
Rank 1
 asked on 17 Oct 2012
1 answer
383 views
I have a grid of Contact data. I am using a custom editor template. The user can edit more data in the editor template than is displayed in the grid. One of the properties on the Contact object is an Array of Phones. In the UI the user can enter as many phone numbers as they want. I have additional fields dynamically added using jquery. Currently, I am running into three issues:

1) Inputs that I dynamically add are not included in the post of the form. Here's an example of a dynamically added input:
<select name="Phones[0].PhoneTypeId">
    <option value="2">Mobile</option>
    <option value="3">Home</option>
    <option value="4">Work</option>
    <option value="5">Main</option>
    <option value="6">Fax</option>
</select>

<input name="Phones[0].Number" type="text">


As mentioned, these values aren't included in the data posted to the server at all.

2) I have created an EditorTemplate for the phone. When I use Html.EditorFor(m => m.Phones) it appears to be completely ignored. I have also tried iterating through the Phone array like this:
@foreach(var phone in Model.Phones)
{
    Html.EditorFor(m => phone)
}

That also gets completely ignored and doesn't produce anything when the data provided should cause phone numbers to show.

3) Due to issue number two mentioned above when editing an existing Contact I have resorted to adding code to just display the first phone number: Html.EditorFor(m => m.Phones[0]) When I do that, the phone number shows up as expected, but if I make a change to the number and submit the form, the data gets submitted like this: Phones[0][Number] instead of like this Phones[0].Number. The default ModelBinder doesn't seem to be able to handle the value being submitted like that, so the values don't get bound to my model.

Any help would be greatly appreciated.
Petur Subev
Telerik team
 answered on 17 Oct 2012
4 answers
270 views
Hi,

The grid fails to render properly when using the following:
datasource =>
             datasource.Ajax().ServerOperation(true)
             .Read(config => config.Url(myActionUrl))
             .Group(config => config.Add(i => i.MyField))

None of the rows gets displayed correctly. It will display the group header with MyField: (undefined) and empty child rows 

It works correctly with :
datasource =>
             datasource.Ajax().ServerOperation(true)
             .Read(config => config.Url(myActionUrl))
             .Group(config => config.Add(i => i.MyField))

Is there a workaround to have initial grouping and client filtering/sorting... ? 

Happens on version : 2012.2.723.340

Thanks for helping
Nikolay Rusev
Telerik team
 answered on 17 Oct 2012
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
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?