Telerik Forums
UI for ASP.NET Core Forum
2 answers
115 views
My grid has InLine edit mode. I add a new row and save it through the Edit column button and the DataSource Create Action. Immediately after saving if I delete the new row through the Destroy column button, the DataSource Destroy Action is not called. The Destroy Action is called on any other row that existed when the page was loaded. I can also delete the added row after a page refresh.
Mark
Top achievements
Rank 1
 answered on 20 Mar 2019
1 answer
165 views

the telerik asp.net mvc grid has the @item to access the bound item  inside a  .Template . There seems to be no documentation on what the replacement is for asp.net core grids . How do we accomplish this? Can you give an example of a .Template that uses a value from the data  

Tsvetina
Telerik team
 answered on 20 Mar 2019
10 answers
151 views

I've got a grid with InCell editing and I have only the Add and Save buttons in the header. The grid is in an iframe. The trouble I am having is when I click the batch save button the controller action in the Datasource is not getting called.

<div>
    @(Html.Kendo().Window()
            .Name("timecard")
            .Modal(true)
            .Actions(actions => actions.Close())
            .Draggable(false)
            .LoadContentFrom("Timecard")
            .Events(events => events
                .Close("timecard_OnClose")
                .Refresh("timecard_OnIframeLoaded")
            )
            .Iframe(true)
            .Width(1700)
            .Height(800)
            .Visible(false)
            .Deferred(true)
    )
</div>
function timecard_OnIframeLoaded(e)
{
    $.ajax({
        url: '@Url.Action("Timecard_Load", "Timecard")',
        type: "POST",
        datatype: "json",
        data: { id: employee_key, weekEnding: week_ending},
        success: timecard_LoadTimecardSuccess
    });
}

 

<div id="employeeTimecard">
    @(Html.Kendo().Grid<Timecard.Models.TimecardViewModel>()
                            .Name("timecard")
                            .ToolBar(toolbar =>
                            {
                                toolbar.Create().Text("ADD").HtmlAttributes(new { title = "Add employee" });
                                toolbar.Save().Text("SAVE");
                            })
                            .Editable(editable => editable.Mode(GridEditMode.InCell))
                            .Columns(columns =>
                            {
                                columns.Bound(p => p.Job).Filterable(false).Sortable(false).Width(115).EditorTemplateName("_InCellAutoCompleteEditor").Title("Job");
                                columns.Bound(p => p.Task).Filterable(false).Sortable(false).Width(50);
                                columns.Bound(p => p.TaskName).Filterable(false).Sortable(false).Width(150);
                                columns.Bound(p => p.SubTask).Filterable(false).Sortable(false).Width(75);
                                columns.Bound(p => p.SubTaskCompDate).Filterable(false).Sortable(false).Width(75);
                                columns.Bound(p => p.TravelPay).Filterable(false).Sortable(false).Width(75).Title("Travel Pay (Total)");
                                columns.Bound(p => p.SpecialPayRate).Filterable(false).Sortable(false).Width(75);
                                columns.Bound(p => p.Comment).Filterable(false).Sortable(false).Width(150);
                                columns.Bound(p => p.MonST).Filterable(false).Sortable(false).Format("{0:n1}").Title("Mon ST").Width(40);
                                columns.Bound(p => p.MonOT).Filterable(false).Sortable(false).Width(40);
                                columns.Bound(p => p.MonDT).Filterable(false).Sortable(false).Width(40);
                                columns.Bound(p => p.TueST).Filterable(false).Sortable(false).Width(40);
                                columns.Bound(p => p.TueOT).Filterable(false).Sortable(false).Width(40);
                                columns.Bound(p => p.TueDT).Filterable(false).Sortable(false).Width(40);
                                columns.Bound(p => p.WedST).Filterable(false).Sortable(false).Width(40);
                                columns.Bound(p => p.WedOT).Filterable(false).Sortable(false).Width(40);
                                columns.Bound(p => p.WedDT).Filterable(false).Sortable(false).Width(40);
                                columns.Bound(p => p.ThuST).Filterable(false).Sortable(false).Width(40);
                                columns.Bound(p => p.ThuOT).Filterable(false).Sortable(false).Width(40);
                                columns.Bound(p => p.ThuDT).Filterable(false).Sortable(false).Width(40);
                                columns.Bound(p => p.FriST).Filterable(false).Sortable(false).Width(40);
                                columns.Bound(p => p.FriOT).Filterable(false).Sortable(false).Width(40);
                                columns.Bound(p => p.FriDT).Filterable(false).Sortable(false).Width(40);
                                columns.Bound(p => p.SatST).Filterable(false).Sortable(false).Hidden(true).Width(40);
                                columns.Bound(p => p.SatOT).Filterable(false).Sortable(false).Width(40);
                                columns.Bound(p => p.SatDT).Filterable(false).Sortable(false).Width(40);
                                columns.Bound(p => p.SunST).Filterable(false).Sortable(false).Hidden(true).Width(40);
                                columns.Bound(p => p.SunOT).Filterable(false).Sortable(false).Hidden(true).Width(40);
                                columns.Bound(p => p.SunDT).Filterable(false).Sortable(false).Width(40);
                                columns.Command(command =>
                                {
                                    command.Destroy().HtmlAttributes(new { title = "Delete highlighted employee"});
                                }).Title("Options").Width(100);
                            })
                            .Sortable()
                            .Scrollable()
                            .Filterable()
                            .HtmlAttributes(new { style = "height:650px;width:1615px;" })
                            .DataSource(dataSource => dataSource
                                .Ajax()
                                .Batch(true)
                                .PageSize(100)
                                .Model(model => model.Id(p => p.EmployeeCode))
                                .Update(update => update.Action("Timecard_Update", "Timecard"))
                            )
    )
</div>

 

 

 

 

Mark
Top achievements
Rank 1
 answered on 19 Mar 2019
2 answers
1.1K+ views
How 2 hidden a tab item or set tab item invisible?
Marin Bratanov
Telerik team
 answered on 18 Mar 2019
1 answer
932 views
I am porting a project that uses the ancient telerikMvcExtensions . I am looking for a replacement for column.Centered() .  I guess my question is how do we align data in a column or apply styles to it ? Would this be through Template or Client Template? If so, can i see an example. Thanks
Eyup
Telerik team
 answered on 18 Mar 2019
4 answers
202 views

Hi

Can anyone help?

How do I include  filter id and forgeryToken in Cascading DropDownList?

Thanks in advance.

 

@(Html.Kendo().DropDownList()
    .Name("Transferee")
    .HtmlAttributes(new { style = "width:100%" })
    .OptionLabel("Select Transferee")
    .DataTextField("UName")
    .DataValueField("IContactId")
    .Filter(FilterType.Contains)
    .DataSource(dataSource => dataSource
    .Ajax()
    .Read(r => r.Url("?handler=Transferee").Data("forgeryToken").Data("filterAgency"))
    .Events(e => e.Error("onError").RequestEnd("onRequestEnd")))
    .Enable(false)
    .AutoBind(false)
    .CascadeFrom("Agency")
)

Misho
Telerik team
 answered on 15 Mar 2019
1 answer
125 views

Hi All,

I am a university student. My group mates and I would like to experiment with the scheduler tool within an ASP.NET Core project in Visual Studio. We are having trouble getting it set up in an empty project. We are wondering what we are missing because each of us (3 total) has taken a different approach and still can't seem to figure it out.

Are you supposed to pull everything from the demo project to use in an actual application?

Pulling the info from the documentation pages leaves multiple errors such as referencing an interface that doesn't exist within the project (but we have no idea where to look for the interface or what it should contain). So, we didn't quite figure out that approach either.

Would anyone be willing to share any steps

 

Any guidance or direction regarding any steps or where to look for instructional help would be greatly appreciated.

Plamen
Telerik team
 answered on 15 Mar 2019
2 answers
230 views

Hello,

In my Grid's Edit PopUp window I have a Kendo NumericTextBoxFor input control to allow the user to add/edit values in the Grid and the underlying model.  When I want to insert a record the NumericTextBox displays a zero "0" which is fine.  However, when the user tabs to this text box or when it gets focus I want the "0" to be highlighted/selected so that the user can change it to a different value without having to click either the delete button or the backspace button to get rid of the "0".  Currently, when the user tabs to this text box the value is momentarily highlighted for a split-second.  Is there a way to have the value get highlighted and stay highlighted until the user tabs out of this input box? 

This is my HTML:

@Html.Kendo().NumericTextBoxFor(model => model.ReplacementCost).Format("C0").Decimals(0).Placeholder("...").HtmlAttributes(new { style = "width: 200px; background-color: white;" }).Spinners(false).Events(e => e
    .Change("replacementCost_change"))

 

This is the script to make it so that the validation message doesn't show if the user clears the value in the text box:

function replacementCost_change() {
    var txtLatitude = $("#ReplacementCost").data("kendoNumericTextBox");
    if ($("#ReplacementCost").val() === '') {
        txtLatitude.value(0);
        txtLatitude.trigger('change');
    }
}

 

Thanks.

Shawn A.

Shawn
Top achievements
Rank 1
 answered on 14 Mar 2019
1 answer
267 views

I was asked to condense one of my Razor pages by having sections create dynamically.  So, instead of bouncing the user over to a separate View they want me to stay on the same View but just expand an area in order to accommodate more input.    I thought I'd run the idea past you guys being as I have no idea how I'd accomplish this.  As a WPF programmer, I could do it there by having an Expander control with a UserControl that binds to a list of Addresses.

 

Capture the information on a person using this type of flow.

FirstName (standard field)

LastName (standard field)

Etc.

Address 1 (push a button to expand)

Address 2 (push a button to expand)

Address 3

Ivan Danchev
Telerik team
 answered on 14 Mar 2019
1 answer
259 views

Ok So I have made some modifications based on teleriks suggestion but now the grid is not readling the lines

 

[AcceptVerbs("Get")]
public ActionResult ActivityLines_Read([DataSourceRequest]DataSourceRequest request ,int? activityID)
{
 
 
    int? _activityId = activityID;
    var result = GetAllActivityLines(activityID);
 
    var dsResult = result.ToDataSourceResult(request);
    return Json(dsResult);
 
}

 

 

The goal I need to achieve is to pass the header id into the lines  and then on my view details button pass the id to the popup so that it is their for saving saving from the main window is not the modal i want to follow which was a suggestion in support ticket.

 

                <div class="form-group row">
 
                    <div class="col-sm-12">
 
                        @(Html.Kendo().Grid<FuelActivityTrackerDal.Models.ActivityLines>
().Name("activityLines")
                        .AutoBind(false)
                        .Events(e => e.Edit("onEdit"))
                        .Columns(columns =>
                        {
                            columns.Bound(p => p.Description).Filterable(false);
                            columns.Bound(p => p.StartTime).Filterable(false);
                            columns.Bound(p => p.EndTime).Filterable(false);
                            columns.Bound(p => p.Status);
                            columns.Command(command => command.Custom("ViewDetails").Click("showDetails"));
 
                        })
                        .DataSource(dataSource => dataSource
                        .Ajax()
                        .Events(events => events.Error("error_handler"))
                        .Model(model => model.Id(p => p.ActivityLineId))
                        .Read(read => read.Action("ActivityLines_Read", "Activity"))
                       .Update(update => update.Action("ActivityLines_Update", "Activity").Type(HttpVerbs.Post)))
 
    )
</div>
                </div>
 
                <div class="form-group row">
                    <div class="col-sm-6">
 
                    </div>
                </div>
 
 
                <button type="button" class="btn btn-primary px-4 float-right">Add Work Item</button>
                <button type="button" class="btn btn-primary px-4 float-right">Put Case & Client On Hold</button>
                <button type="button" class="btn btn-primary px-4">Cancel</button>
            </form>
        </div>
    </div>
    @(Html.Kendo().Window().Name("Details")
                    .Title("Activity Details")
                    .Visible(false)
                    .Modal(true)
                    .Draggable(true)
                    .Width(400)
    )
    <script type="text/x-kendo-template" id="template">
        <form method="post" action="@Url.Action("ActivityLines_Update", "Activity")">
 
            <div id="details-container">
 
                ActivitiyHeadId
                <div class="form-group row">
                    <div class="col-sm-9">
                        <label for="inputFirstname">Activty Name</label>
                        <input type="text" class="form-control" id="inputFirstname" placeholder="Activity name">
                    </div>
                </div>
                <div class="form-group row">
                    <div class="col-md-10">
                        <label for="inputLastname" class="form-control">Description</label>
                  
                    </div>
                </div>
                <div class="form-group row">
                    <div class="col-md-6">
                        <label for="inputLastname" class="form-control">Start Time</label>
 
 
                    </div>
                    <div class="col-md-6">
                        <label for="inputLastname" class="form-control">End Time </label>
 
 
                    </div>
                </div>
 
            </div>
            <input type="submit" class="btn btn-file px-4" value="Save Work Item" />
 
 
            <button type="button" class="btn btn-primary px-4">Cancel</button>
 
        </form>
    </script>

 

My Entire activity controller.

 

public class ActivityController : Controller
    {
        public int ActivityLineId { get; set; }
        private readonly IActivityHeaderRepository _activityRepo;
        public ActivityController(IActivityHeaderRepository activityRepo)
        {
 
 
            _activityRepo = activityRepo;
 
        }
        [AcceptVerbs("Post")]
        public bool SaveWorkItem(ActivityLines activityLines)
        {
       
            return _activityRepo.UpdateActivityLines(activityLines);
 
 
        }
   
        [AcceptVerbs("Post")]
        public ActionResult EditingPopup_Update([DataSourceRequest] DataSourceRequest request, ActivityHeader activity)
        {
            if (activity != null)
            {
                UpdateActivity(activity);
            }
 
            return Json(new[] { activity }.ToDataSourceResult(request, ModelState));
        }
        [AcceptVerbs("Post")]
        public ActionResult ActivityLines_Update([DataSourceRequest] DataSourceRequest request, ActivityLines activityLines,int? activityID)
        {
 
            if (activityLines != null)
            {
                _activityRepo.UpdateActivityLines(activityLines);
            }
            return Json(new[] { activityLines }.ToDataSourceResult(request, ModelState));
 
 
 
        }
        [AcceptVerbs("Get")]
        public ActionResult ActivityLines_Read([DataSourceRequest]DataSourceRequest request ,int? activityID)
        {
 
 
            int? _activityId = activityID;
            var result = GetAllActivityLines(activityID);
 
            var dsResult = result.ToDataSourceResult(request);
            return Json(dsResult);
 
        }
 
 
 
        public ActionResult Activity_Read([DataSourceRequest]DataSourceRequest request)
        {
            var result = GetAllActivityHeader();
 
            var dsResult = result.ToDataSourceResult(request);
            return Json(dsResult);
        }
        public List<ActivityEditViewModal> GetAllActivityHeader()
        {
            return _activityRepo.GetAllActivites();
        }
        public List<ActivityLines> GetAllActivityLines(int? activityID)
        {
            return _activityRepo.GetActivityLines(activityID);
        }
 
 
        public bool UpdateActivityLines(ActivityLines activityLine)
        {
            return _activityRepo.UpdateActivityLines(activityLine);
        }
 
        public bool UpdateActivity(ActivityHeader activityHeader)
        {
            return _activityRepo.UpdateActivityHeader(activityHeader);
        }
 
        public ActionResult Index()
        {
            List<StaffMembers> _staffmembers = new List<StaffMembers>();
            _staffmembers = _activityRepo.GetAllStaffMembers();
            _staffmembers.Insert(0, new StaffMembers { DepartmentId = 0, StaffID = 0, FirstName = "Select" });
            ViewBag.ListOfStaff = _staffmembers;
 
            var _projectTypes = _activityRepo.GetStandardLookups(Constants.ProjectTypesLookupGroup);
            ViewBag.ProjectTypes = _projectTypes;
 
 
            var _projectStatusTypes = _activityRepo.GetStandardLookups(Constants.ProjectStatusLookupGroup);
            ViewBag.ProjectStatusTypes = _projectStatusTypes;
            SetupRadioButtons();
             var acitivityList = GetAllActivityHeader();
            return View(acitivityList);
 
        }
 
        public void SetupRadioButtons()
        {
            List<SelectListItem> items = new List<SelectListItem>();
 
            Dictionary<string, string> dictionary = new Dictionary<string, string>();
 
            dictionary.Add("Sop", "1");
            dictionary.Add("Remote", "2");
            dictionary.Add("OnSite", "3");
 
            foreach (KeyValuePair<string, string> pair in dictionary)
            {
                items.Add(new SelectListItem() { Text = pair.Key, Value = pair.Value, Selected = false });
            }
 
            ViewBag.Location = new SelectList(items, "Value", "Text");
        }
  
    }
}

 

 

My Model of detail and lines

 

public class ActivityHeader
{
    public int ActivityHeaderId { get; set; } //(int, null)
    public DateTime? ActivityDate { get; set; } //(date, null)
    public string Name { get; set; } //(nvarchar(350), null)
    public DateTime? ActivityEndDate { get; set; } //(datetime, null)
    public string ProblemDescription { get; set; }
    public string Description { get; set; } //(nvarchar(max), null)
 
    public int? ActivityLinesId { get; set; } //(int, null)
    public int? HoursLeftOnProject { get; set; } //(time(7), null)
    public int? Status { get; set; } //(nchar(10), null)
      public DateTime? CreatedDate { get; set; } //(date, null)
    public string CreatedBy { get; set; } //(nvarchar(50), null)
    public bool? isActive { get; set; } //(bit, null)
    public bool? isDeleted { get; set; } //(bit, null)
    public bool? isArchived { get; set; } //(bit, null)
    public int? SOP { get; set; } //(nvarchar(50), null)
    public int? OnSite { get; set; }
    public int? Remote { get; set; }
     
    public int? DepartmentId { get; set; } //(int, null)
    public string EmployeeName { get; set; } //(nvarchar(301), null)
    [ForeignKey("StaffId")]
    public int? StaffId { get; set; }
    public  virtual StaffMembers StaffMembers { get; set; }
 
    public ICollection<ActivityLines> ActivityLines { get; set; }
 
 
}

As you see above activity lines is a ICollection of activity header  All i want to be able to do is a simple crud on the lines within the popup.

public class ActivityLines
    {
        [Key]
        public int ActivityLineId { get; set; } //(int, not null)
        public int? ActivityHeaderId { get; set; } //(int, null)
        public string Description { get; set; } //(nvarchar(max), null)
        public string Notes { get; set; } //(nvarchar(max), null)
        public DateTime? StartTime { get; set; } //(time(7), null)
        public DateTime? EndTime { get; set; }
        public DateTime? StartDate { get; set; }
        public DateTime? EndDate { get; set; } //(time(7), null)
        public int? StaffMemeber { get; set; } //(int, null)
        public bool? isActive { get; set; } //(bit, null)
        public bool? isDeleted { get; set; } //(bit, null)
        public string CreatedBy { get; set; } //(nvarchar(50), null)
        public DateTime? CreatedDate { get; set; } //(date, null)
        public int? Status { get; set; } //(int, null)
      
    }

 

Tsvetina
Telerik team
 answered on 13 Mar 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?