Telerik Forums
UI for ASP.NET MVC Forum
1 answer
228 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
139 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
118 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
155 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
304 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
235 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
307 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
513 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
394 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
794 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
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
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?