Telerik Forums
UI for ASP.NET MVC Forum
2 answers
467 views
Hi,

I'm wondering if it's possible to bind the ForeignKey column builder to a collection other than MVC's SelectList (for example, one with items containing properties other than just Id and Text).

In the regular DropDownListBuilder, there is an overload of BindTo() that takes an IEnumerable that allows you to do this, but from looking at the source code, all of the ForeignKey overloads for IEnumerable just convert it to a SelectList internally. My reason for wanting this is that we frequently have cases where the data in the ForeignKey needs an additional ID property for some related entity that we use for filtering the data source later.

The only way I've found to solve this so far is to use a Bound column instead and specify an editor template that uses a DropDownList with the BindTo overload that takes an IEnumerable. The problem with this is that the column will only display the integer ID outside of edit mode -- using ForeignKey will do the ID -> text mappings automatically in either mode. Is there a better way to do this?

Thanks,
Nick
Nicholas
Top achievements
Rank 1
 answered on 24 Jul 2014
1 answer
79 views
Hello,

In order to activate the adaptive rendering on the Scheduler, i have added Mobile() configuration like this:

.Mobile(MobileMode.Tablet)  and also for phone in phone view file.

But after adding this now when Scheduler loads on mobile device it doesnt not Show all Events on load. But if i Change week view or just navigate it will refresh and Display all .

Is there something i am missing?

Anamika
Georgi Krustev
Telerik team
 answered on 24 Jul 2014
6 answers
744 views
Hi there,

Following advice on another thread, I am using a client template to display a checkbox in place of a boolean field (named BooleanPropertyName for the purposes of this example):

Column Declaration:
 
columns => columns.Bound(m=> m.BooleanPropertyName).ClientTemplate(
"<input type='checkbox' " +
                                "#=BooleanPropertyName? 'checked=checked' : '' #" +
                                "disabled='disabled'</input>");


This is working fine when it comes to displaying and indeed editing the data. However, I am experiencing a problem when attempting to add a new record. I am using a custom edit form with the grid popup.

When clicking on the add button, I receive a jQuery error: "BooleanPropertyName" is undefined.". I can see where the error is occurring in what seems to be a function generated by the kendo grid:

function anonymous(data) {
var o,e=kendo.htmlEncode;with(data){o='<tr data-uid="'+(data.uid)+'" role=\'row\'><td  role=\'gridcell\'>'+e(data.OtherProperty==null?'':data.OtherProperty)+'</td><td  role=\'gridcell\'>'+(BooleanPropertyName ? 'Yes' : 'No' )+'</td><td  role=\'gridcell\'></tr>';}return o;
}


In the example above, I have included another property which is coming from a bound column - this appears to be working fine as it can get past this property before hitting the error.

I am fairly new to Kendo controls - what way do I need to modify the output of my client template in order to resolve this error?

Thanks,

P

Nikolay Rusev
Telerik team
 answered on 24 Jul 2014
1 answer
221 views
Hi there,

I have a Kendo MVC Grid where I have added a per row dropdown menu (similar to that found in this thread). This is using a Kendo Menu which is created at runtime via some configuration options I have set up in the project.

This works fine when the menu contains custom actions which I wish to execute (i.e. redirecting to another screen or displaying custom modal screen).

However, I was looking to include an "Edit" option in this menu which would trigger the built in Kendo Grid editing function which I have set up - either inline, incell or popup depending on which I require.

I'm not sure I have ever seen an example of a custom button or menu action which triggers a built in Kendo Grid function - can you point me towards an example of this?

Thanks,

Paul
Dimo
Telerik team
 answered on 24 Jul 2014
1 answer
135 views
Hi,
I build a timelog system where the user key in the normal hours by selecting the Dropdown list. The column will have 2 dropdowns and it will shour HOUR and Mins respectively.

Any way I can do that via GRID with CRUD ?

Please help direct me.

Thanks.

Regards,
CH
Alexander Popov
Telerik team
 answered on 24 Jul 2014
0 answers
116 views
For those developers tearing there hair out wondering why loading content via Ajax in IE has slowed down. It is NOT a problem with Kendo 2014 Q2.

Please add your voice to the Microsoft connect site, if your site is impacted.

https://connect.microsoft.com/IE/feedback/details/916652/ie-9-ie-11-freezes-in-some-situations-after-installation-of-kb2962872
Timothy
Top achievements
Rank 1
 asked on 24 Jul 2014
1 answer
151 views
Hello Team,

I have a grid with name like RoleDetailsGrid_#=NumberedId# .Now using jquery I want to read the data data of this grid.
I am doing like this.

                    var inum;
                    inum=0;

                    var gridname = "RoleDetailsGrid_" + inum.toString();
                    $(gridname).data('kendoGrid').dataSource.read();

But it is not working.Cab you please look into this issue and let me know the best possible solution.

Urgently required.

Thanks in Advance.

Preeti Singh

Dimiter Madjarov
Telerik team
 answered on 23 Jul 2014
1 answer
297 views
I have the following issue which may be something I've missed along the code.

One TemplateEditor for a ViewModel to produce a DropDownList with choices from a database:

@model MyApp.ViewModels.JobTitleViewModel
 
@(Html.Kendo().DropDownListFor(m => m)
.DataValueField("Id")
.DataTextField("Name")
.DataSource(r => r.Read("GetAll", "JobTitles"))
.HtmlAttributes(new { style = "width:90%" })
)

A controller action to return the current list of active items on the database:

[AllowAnonymous]
public JsonResult GetAll()
{
    var titles = context.JobTitles
        .Where(e => e.IsActive == true)
        .OrderBy(e => e.Name)
        .Select(t => new JobTitleViewModel
        {
            Id = t.Id,
            Name = t.Name,
            IsActive = t.IsActive
        });
     
    return this.Json(titles, JsonRequestBehavior.AllowGet);
}

Finally, a View where the user picks the desired option, and submit it back:

@model MyApp.Models.RegisterViewModel
@{
    ViewBag.Title = "Register";
}
 
<h2>@ViewBag.Title</h2>
 
@using (Html.BeginForm("Register", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
    @Html.AntiForgeryToken()
    <hr />
    @Html.ValidationSummary("", new { @class = "text-danger" })
     
    <div class="form-group">
        @Html.LabelFor(m => m.FullName, new { @class= "col-md-2 control-label"})
        <div class="col-md-10">
            @Html.TextBoxFor(m => m.FullName, new { @class="form-control"})
        </div>
    </div>
 
    <div class="form-group">
        @Html.LabelFor(m => m.JobTitle.Name, new { @class = "col-md-2 control-label" })
        <div class="col-md-10">
            @Html.EditorFor(m => m.JobTitle, new { @class = "form-control" })
        </div>
    </div>
 
    <div class="form-group">
        @Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" })
        <div class="col-md-10">
            @Html.TextBoxFor(m => m.Email, new { @class = "form-control" })
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" })
        <div class="col-md-10">
            @Html.PasswordFor(m => m.Password, new { @class = "form-control" })
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" })
        <div class="col-md-10">
            @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" })
        </div>
    </div>
    <div class="form-group">
        <div class="col-md-offset-2 col-md-10">
            <input type="submit" class="btn btn-default" value="Registra" />
        </div>
    </div>
}
 
@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}


The editor is "hinted" using data annotation on the ViewModel :

public class RegisterViewModel
{
    [Required]
    [EmailAddress]
    [Display(Name = "Email")]
    public string Email { get; set; }
 
    [Required]
    [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
    [DataType(DataType.Password)]
    [Display(Name = "Password")]
    public string Password { get; set; }
 
    [DataType(DataType.Password)]
    [Display(Name = "Confirm password")]
    [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
    public string ConfirmPassword { get; set; }
 
    [StringLength(80, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 4)]
    [Display(Name = "Name")]
    public string FullName { get; set; }
 
    [UIHint("JobTitleEditor")]
    public JobTitleViewModel JobTitle { get; set; }
}


When the View is submitted back, the ModelState is not valid with an error associated with the JobTitle property, resulting in an exception with the following text:

The parameter conversion from type 'System.String' to type 'MyApp.ViewModels.JobTitleViewModel' failed because no type converter can convert between these types.

Could you please point what am I doing wrong ??

Regards.

Georgi Krustev
Telerik team
 answered on 23 Jul 2014
3 answers
225 views
Hi I am hoping you can help me,
I would like to be able to double click on an existing event in the scheduler but instead of editing the event information in the edit template, I would like to be redirected to the specific Event's detail/edit page where via its url.

What would be the best way of achieving this?

Using: MVC5

Thanks
Farhad
Top achievements
Rank 1
 answered on 23 Jul 2014
4 answers
302 views
Hi,
I have an application to capture the Project Stage based on the project selected in my grid. I have 2 columns(Project and ProjectS 
@(Html.Kendo().Grid<Data>() .Name("Detail") .ToolBar(tool => { tool.Create().Text("New Project");})
      .Columns(columns =>{
             columns.Bound(f => f.PROJECT).Title("Project Name").ClientTemplate("#: PROJECT.PROJ_NAME #");
             columns.Bound(f => f.PROJSTAGE).Title("Stage").Width(400).ClientTemplate("#: PROJSTAGE.PROJ_STAGE #");
             columns.Bound(f => f.REMARK).Title("Remark");
             columns.Command(commands => {commands.Edit();}); })
      .Editable(e => { e.Mode(GridEditMode.InLine).DisplayDeleteConfirmation(false); })
      .DataSource(dataSource => dataSource
   .Ajax()
   .Model(m => {
 m.Id(f => f.SEQ_ID);                                
 m.Field(f => f.PROJECT).DefaultValue(ViewData["defaultProject"] as DPA.ETimelog.Models.Project);
 m.Field(f => f.PROJSTAGE).DefaultValue(ViewData["defaultProjStage"] as PA.ETimelog.Models.ProjStage);
 m.Field(f => f.REMARK);})
     .Read(read => read.Action("test_read", "Home"))
     .Create(create => create.Action("test_create", "Home"))
 )
  )

My Editor for Project
@model object
<script>
    function eProjectReadData() {
        return { startDate:selectedDate.toJSON() };
    }
</script>
 
@(
 Html.Kendo().DropDownListFor(m => m)  
      .OptionLabel("-please select-")
       .HtmlAttributes(new { style = "width: 200px" })
      .DataTextField("PROJ_NAME")
      .DataValueField("PROJ_NO")
      .DataSource(source => {source.Read(read =>{read.Action("GetProjectAssignedToMember",  "eProject").Data("eProjectReadData");});})
      
)

My editor for Project Stage:
@model object
 
@(
 Html.Kendo().DropDownListFor(m => m)
        .OptionLabel("-please select-")
                .DataTextField("PROJ_STAGE")
                .DataValueField("PROJ_STAGE_ID")              
            .DataSource(source =>
            {
                source.Read(read =>
                { read.Action("GetProjStage", "Home");});
            })
)

When in add\edit mode in grid,
when user select the project type, i wanted to auto populate the project stage of the current project. How can i achieve that?

Please advise.
Thanks.

Regards,
CH
Top achievements
Rank 1
 answered on 23 Jul 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
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
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?