Telerik Forums
UI for ASP.NET Core Forum
1 answer
115 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
221 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
258 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
257 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
1 answer
105 views
Hi I managed to get most of my crud experience working but i cant believe that in 2019 we still have the boring javascript confirmation dialog for delete is their any way of making this look better at all.
Viktor Tachev
Telerik team
 answered on 13 Mar 2019
1 answer
438 views

I have grid and several textarea in a page. I want to bind the textarea “value” attribute to the gird's selected row(a column). when the gird change the selected row, the textarea value change. and change the text of textarea, the grid content change.

how can i get it.

I am trying to bind in grid change event, but when I change the textarea value, the selected row disappeared.

Konstantin Dikov
Telerik team
 answered on 13 Mar 2019
8 answers
374 views
Hi, not sure if anyone would know this, but when I hit "Add new Record" and I fill out the new record I'd like to hit CTRL+ENTER and it "insert" that record. Anyone have any idea how to do this? I looked on google but couldn't quite figure it out.
Cody
Top achievements
Rank 1
 answered on 13 Mar 2019
10 answers
1.0K+ views
How does one pass the id to the template so one can use it basically i want 0 for adding a record then obv the id value for eidting a record how does one acheive this when using a custom command editor for template.
Tsvetomir
Telerik team
 answered on 12 Mar 2019
1 answer
105 views
Hello. I am new at using Calendar for ASP.NET Core.
in my project every month has 6 weeks. And the last week in every month is empty. How can I delete this week?
Eyup
Telerik team
 answered on 12 Mar 2019
5 answers
331 views

Im trying to do this as a taghelper

@(Html.Kendo().DatePickerFor(m => m.Pressefoto).Deferred())

With this

<kendo-datepicker name="Pressefoto" asp-for="Pressefoto" deferred="true" />

asp-for  does not work, no value from model

and I need to specify name or I get a runtime error

Laurie
Top achievements
Rank 2
 answered on 12 Mar 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?