Telerik Forums
UI for ASP.NET MVC Forum
0 answers
103 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
119 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
267 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
197 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
271 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
3 answers
480 views
I am not sure what I am missing here, I have a grid that I just want to update, not create or destroy. I thought I had done this correctly, but the save button does not fire my update method on the user controller.  

  <div id="CampaignGrid">
        @(Html.Kendo().Grid<SubCampaign>()
              .Name("grid")
              
              .Columns(columns =>
              {
                  columns.Bound(c => c.CampaignName);
                  columns.Bound(c => c.Status).ClientTemplate("<input type='checkbox' value='#= Status #' " +
                                                                "# if (Status) { #" +
                                                                    "checked='checked'" +
                                                                "# } #" +
                                                            "/>");
              })
              .ToolBar(toolbar => toolbar.Save())
                    .Editable(editable => editable.Mode(GridEditMode.InCell))
                    .DataSource(dataSource => 
                        dataSource.Ajax()
                        .Batch(true)
                        .Model(model =>
                        {
                            model.Id(campaign => campaign.Id);
                            model.Field(campaign => campaign.CampaignName).Editable(false);
                            model.Field(campaign => campaign.Status);
                        })
                        .Read(read => read.Action("SwitchCampaignRead", "User"))
                        .Update(update => update.Action("SwitchCampaigns", "User")))
                        .HtmlAttributes(new { style = "height: 380px;" })
                        .Scrollable()
                        .Sortable()
                        .Pageable(pageable => pageable
                            .Refresh(true)
                            .PageSizes(true)
                            .ButtonCount(5))

              )
    </div>
Kelso
Top achievements
Rank 1
 answered on 22 Jul 2014
4 answers
375 views
I am using the latest kendoui internal build (2013.2.808.340) in order fix some other issues I am having with the current release build.

I have found that when using the MVC wrappers and setting the the class attribute via .HTMLAtrributes on commands in the grid kendo no longer renders the button with the correct class.

Example: 
c.Command(command =>
    {
command.Edit().HtmlAttributes(new { @class = "btn" }).UpdateText("Save");
command.Destroy().HtmlAttributes(new { @class = "btn" });
                             });

Resulting rendered HTML no longer has the class "btn":
<a class="k-button k-button-icontext k-grid-edit" href="#">


Dimiter Madjarov
Telerik team
 answered on 22 Jul 2014
5 answers
740 views
I'm defining a window in Asp.net mvc with following:
@(Html.Kendo().Window()
    .Name("staffsec")
    .Title("Edit")
    .Actions(a => a.Minimize().Maximize().Close())
    .Content("")
    .Modal(true)
    .Visible(false)
    .Width(440)
    .Height(500)
    .Scrollable(true)
    .Position(settings =>
    settings.Top(50).Left(300))
)

And using follwing Java Script to load the window

 
var staffId = '@Html.Raw(Json.Encode(Model.StaffModel.StaffId))';
 var windowk = $("#staffsec").data("kendoWindow");
windowk.refresh({< url: "@Url.Content("/StaffSecurity/Index/")", data: { id: staffId  });<br>windowk.title("Staff Security"); windowk.open();
return event.preventDefault();

Issue is, window is displayed only first time i click. Next time i click i get error on console that 'windowk' is undefined. I've used the same technique on different form, there is no issue. 
Words of wisdom will be appreciated..

Abdul Rehman







Dimo
Telerik team
 answered on 22 Jul 2014
1 answer
193 views

Hi

I need to create a search modal window that allows me to
type a search criteria, display the results on a grid, allow the user 
select a row from that grid and then pass the Id of the select row back
to parent window.

I'm using MVC5 and  Kendo UI.

What's the best way to achieve this?
Dimo
Telerik team
 answered on 22 Jul 2014
4 answers
856 views
@(Html.Kendo().Grid<positions.Models.vOpenPositionsDistinct>()
.Name("gridMain")
.DataSource(dataSource => dataSource // Configure the grid data source
.Ajax() // Specify that ajax binding is used
.Read(read => read.Action("Positions_Read", "Home")) // Set the action method which will return the data in JSON format
)
.Columns(columns =>
{
columns.Bound(s => s.SourceURL).ClientTemplate("<a href='" + Url.Content("#= SourceURL #") + "' target='_blank'>#: SourceURL #</a>").HeaderTemplate("Source URL").Width(120);

})

I have external url links stored in my database and I want to bind them in a grid column as <a href> tag. If I use the code above all rows will have the 1st row SourceURL Value .

What am I doing wrong? It seems as if it creates a generic template for all rows and the template has same url.

Jim
Top achievements
Rank 1
 answered on 22 Jul 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
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?