Telerik Forums
UI for ASP.NET MVC Forum
1 answer
380 views

Looking to implement a combination of functionality while using the Grid in InLine mode. Thus far searches have not brought up directly applicable examples or details on the event lifecycles for the grid.

Is there anywhere that shows an event lifecycle for the Grid?

Looking to know what events are available to work with (Grid/javascript/JQuery all valid) for controlling what happens when a row enters into EditMode AND if a new row is Added (Which therefore is automatically opened into edit mode but no datasource command has fired yet.

The functionality looking to implement:

  1. Setting which cell in the row focus is set to when the row opens up int InLine edit mode
  2. Selecting all contents of cell clicked that is in the row in edit mode
  3. When a new row is added (Automatically opened); set the following column dropdown values to some defaults. This is so it is visually already selected for the user and they can still change it if need be.

Columns:

c.ForeignKey(vm => vm.LocationNumber, (System.Collections.IEnumerable)ViewData["LocationsList"], "LocationNumber", "Drop_Text").HtmlAttributes(new { onchange = "triggerDropChange(this);" }).Width(200).Hidden(Model.Locations_ColumnInitHidden); //Display UIHint in Dropdown through LocationsList ClientTemplate with just the LocationNumber value behind
                                                                                                                                                                                                                                                                //c.ForeignKey(vm => vm.State, (System.Collections.IEnumerable)ViewData["StateList"], "Value", "Text").Width(120);
c.Bound(vm => vm.State).HtmlAttributes(new { @class = "locationLinkedState" }).Width(80);

 

The Datasource Create command already can set a default value if left blank; though that would not matter to a user till they sent the row through by clicking on the row Update command. So the aim in 3. is to have the default already selected for the user.

 

Any information on the available event lifecycles and the implementation of the mentioned functionality will be greatly appreciated.

Konstantin Dikov
Telerik team
 answered on 22 Jun 2017
3 answers
3.1K+ views

How can I reset a Kendo Upload control based upon a button click event?

 

Dimiter Madjarov
Telerik team
 answered on 22 Jun 2017
1 answer
7.6K+ views
Hi, I want to set a default filter value for a column on the grid but only if the application is not already persisting state.  My question is how do I set a filter programmatically in this scenario?  There is a Boolean column called "Enabled" that I am trying to default to TRUE when no pervious grid state can be found on client.

var localStorageKey = "UserAdministrationUserGridOptions";
 
$(function () {
    // pull client grid state and apply to grid (filters, current page, sorts, etc).
    setGridOptions();
});
 
function setGridOptions() {
    var options = localStorage[localStorageKey];
 
    if (options) {
        $("#UserAdministrationUserGrid").data("kendoGrid").setOptions(JSON.parse(options));
    }
    else
    {
    // set initial enabled filter to true
   // HOW DO I DO THIS IN JAVASCRIPT
    // server: .Filter(f => f.Add(m=> m.Enabled).IsEqualTo(true))
    }
}
Sam
Top achievements
Rank 1
 answered on 21 Jun 2017
6 answers
443 views

hello,

Recently I updated my Kendo version from 2014 to 2017 r2

I try to implemented the pdf export on my Scheduler but when I click on export I got a blank pdf file.

I have a view with style and script: 

<style>
    /*
        Use the DejaVu Sans font for display and embedding in the PDF file.
        The standard PDF fonts have no support for Unicode characters.
    */
    .k-scheduler {
        font-family: "DejaVu Sans", "Arial", sans-serif;
    }
 
    /* Hide toolbar, navigation and footer during export */
    .k-pdf-export .k-scheduler-toolbar,
    .k-pdf-export .k-scheduler-navigation .k-nav-today,
    .k-pdf-export .k-scheduler-navigation .k-nav-prev,
    .k-pdf-export .k-scheduler-navigation .k-nav-next,
    .k-pdf-export .k-scheduler-footer {
        display: none;
    }
</style>
 
<script src="@Url.Content("~/Scripts/pako.min.js")"></script>
 
<h1 class="titrePlanning">Planning Electro</h1>
@Html.Partial("ControlPanel")
<div class="wrapper">
    <div id="divScheduler">
        @(Html.Kendo().Scheduler<Ubaldi.Logisttique.PlanningRDV.Web.Controllers.EventViewModel>()
        .Name("scheduler")
        .DateHeaderTemplate("<span class='k-link k-nav-day'>#=kendo.toString(date, 'ddd dd/MM')#</span>")
        .Selectable(false)
        .Timezone("Etc/UTC")
        .Width(1200)
         .Pdf(pdf => pdf
            .FileName("Export_PlanningRDV.pdf")
            .ProxyURL(Url.Action("Pdf_Export_Save", "Scheduler"))
    )
    .Toolbar(t => t.Pdf())

 

- I also imported Deja Vus font in \Content\fonts\DejaVu

In my contoller:

public ActionResult Pdf_Export_Save(string contentType, string base64, string fileName)
{
    var fileContents = Convert.FromBase64String(base64);
 
    return File(fileContents, contentType, fileName);
}

 

I try with and without ProxyUrl and I'm getting the same issue.Do I miss something ?

Dimitar
Telerik team
 answered on 21 Jun 2017
3 answers
202 views

With Kendo ASP.Net Ajax there is a style sheet manager that can be used to switch between several styles for the Kendo controls. Is there an equivalent in the MVC?

 

Nikolay
Telerik team
 answered on 21 Jun 2017
6 answers
250 views

Hi,

 

I have an Ajax action link which GETs a partial view and insert it after a certain div on my page. That partial view contains a Kendo ComboBox which is bound to a SelectList in my model. But the ComboBox doesn't work at all when the partial has been inserted. None of the styling and functionality is there at all. In fact, all the kendo html is gone. There are no elements with the "k-combobox" and "k-widget" stuff. Everything is gone, and all I'm left with is

 

<input data-val="true" data-val-number="Feltet Prosjekt må være et tall." id="Sections_8fcdf2f0-53c3-45e3-9498-41aeaccf3ad4__ProjectId" name="Sections[8fcdf2f0-53c3-45e3-9498-41aeaccf3ad4].ProjectId" type="text" value="1">
<script>
    jQuery(function(){jQuery("#Sections_8fcdf2f0-53c3-45e3-9498-41aeaccf3ad4__ProjectId").kendoComboBox({"dataSource":[{"Text":"Testprosjekt","Value":"1"},{"Text":"asd","Value":"2"},{"Text":"Ttest","Value":"3"},{"Text":"asd","Value":"4"},{"Text":"Best Project Ever","Value":"5"},{"Text":"test2000","Value":"6"},{"Text":"asdiasd","Value":"7"},{"Text":"ghghj","Value":"8"},{"Text":"sdfsd","Value":"9"},{"Text":"rtrtfgh","Value":"10"}],"dataTextField":"Text","dataValueField":"Value","placeholder":"Velg prosjekt...","suggest":true});});
</script>

 

 

 

 

 

 

Yngve
Top achievements
Rank 1
 answered on 21 Jun 2017
3 answers
158 views
Is there a way to generate a static sparkline chart on the server? I'd like to include a sparkline in a system-generated email.
Tsvetina
Telerik team
 answered on 21 Jun 2017
1 answer
211 views

I have a dropdownlist on the Add Record template on a detail Grid.  I need to pass details of the parent model with the read method of the dropdownlist datasource.  Here is my code:

  $scope.detailGridOptions = function (dataItem) {
      return {
          dataSource: {
              type: 'aspnetmvc-ajax',
              transport: {
                  read: "/SSQV4/SSQV5/Operator/GetTaggedContractorsByMajor"
                  ,
                  create: "/SSQV4/SSQV5/Operator/AddContractorToTag"
              },
              serverPaging: true,
              serverSorting: true,
              serverFiltering: true,
              schema: {
                  data: "Data",
                  total: "Total",
                  model: {
                    id: "CompanyID",
                    fields: {
                        CompanyID: { editable: true, nullable: false, type: "number" },
                        TagID: { editable: true, nullable: true, type: "number" },
                        vchCompanyName: { editable: false, nullable: false, type: "string"},
                        Date: { editable: false, nullable: false, type: "date" },
                        AddedBy: { editable: false, nullable: false, type: "string" }
              }
          }
              },
              pageSize: 5,
              filter: { field: "TagID", operator: "eq", value: dataItem.TagID }
          },
          scrollable: false,
          sortable: true,
          pageable: true,
          editable: "popup",
          edit: function (e) {
              var grid = $scope.tagsGrid;
              var uid = e.model.uid;
              var selector = kendo.format("tr[data-uid='{0}']", uid);
              var currentGridElement = $(selector).closest("[data-role=grid]");
              var parentRow = currentGridElement.closest(".k-detail-row").prev();
              var parentModel = grid.dataItem(parentRow);
              e.model.TagID = parentModel.TagID;
          },
          toolbar: ["create"],
          columns: [
          {
              field: "TagID"
            , hidden: true
          }
          ,
              {
                  field: "CompanyID",
                  title: "CompanyID"
                  , editor: companyDropDownEditor
              }
          ,
            {
                field: "vchCompanyName",
                title: "Company Name"
            }
            ,
              {
                  field: "Date",
                  title: "Date Added"
              }
              ,
              {
                  field: "AddedBy",
                  title: "Added By"
              }
          ]

      };
  };

  function companyDropDownEditor(container, options) {
      var grid = $scope.tagsGrid;
      var uid = options.model.uid;
      var selector = kendo.format("tr[data-uid='{0}']", uid);
      var currentGridElement = $(selector).closest("[data-role=grid]");
      var parentRow = currentGridElement.closest(".k-detail-row").prev();
      var parentModel = grid.dataItem(parentRow);
     
      

      $('<input required name="' + options.field + '"/>')
          .appendTo(container)
          .kendoDropDownList({
              autoBind: true,
              dataTextField: "CompanyName",
              dataValueField: "CompanyID",
              template:  "#=CompanyName#",
              dataSource: {
                  transport: {
                      read: "/SSQV4/SSQV5/Operator/GetUntaggedContractors",
                      data: {contractor: parentModel}
                  }
              }
              
          });
  }

Here is my MVC Action Method:

        public async Task<ActionResult> GetUntaggedContractors([DataSourceRequest] DataSourceRequest request,
            ContractorTagModel contractor)
        {
            majorId = UserInfo.intMajorID;
            var tagId = contractor.TagID;
            var contractors = await CompanyClient.GetUntaggedContractors(majorId, tagId);
            return Json(contractors, JsonRequestBehavior.AllowGet);
        }

When the Action Method is hit, the model is always empty.  I actually don't need the entire model, just the TagID, but I don't get anything but zeros in my model.  Any assistance is greatly appreciated!

 

Joana
Telerik team
 answered on 20 Jun 2017
4 answers
446 views

Hi there guys, its me again. I have a tab-strip that calls a details page for a Person,House, and Car tab. These tabs display the data just fine. On each detail page, i have an edit button, when i click the edit button, right now, when i click the edit button,  i am re-directed to the edit page outside of the tab-strip which isn't what i want. How do i make it load up the edit page within the tab-strip and ultimately when i click save, how to i make  re-load the details page again within the tab-strip.

Index.cshtml- from the InfoController

01.<div class="demo-section k-content">
02.    @(Html.Kendo().TabStrip()
03.          .Name("tabstrip")
04.          .Animation(animation => animation.Open(effect => effect.Fade(FadeDirection.In)))
05.          .Items(tabstrip =>
06.          {
07.            tabstrip.Add().Text("Person")
08.               .Content(@<text> <div class="form-group"> @Html.Action("Detail", "Person", new { id = 1 }) </div> </text>);
09. 
10.             tabstrip.Add().Text("House")
11.                .Content(@<text> <div class="form-group"> @Html.Action("Detail", "House", new { id = 1 }) </div> </text>);
12. 
13.             tabstrip.Add().Text("Car")
14.                .Content(@<text> <div class="form-group"> @Html.Action("Detail", "Car", new { id = 1 }) </div></text>);
15.          })
16.)
17.</div>
18. 
19. 
20. 
21.<script type="text/javascript">
22. 
23.    $(document).ready(function () {
24.        $("#tabstrip").kendoTabStrip({
25.            animation: {
26.                open: {
27.                    effects: "fadeIn"
28.                }
29.            }
30.        });
31. 
32.</script>

 

Here is the InfoController.cs

01.using System;
02.using System.Collections.Generic;
03.using System.Linq;
04.using System.Web;
05.using System.Web.Mvc;
06. 
07.namespace JustTestingWeb4.Controllers
08.{
09.    public class InfoController : Controller
10.    {
11.        // GET: Info
12.        public ActionResult Index()
13.        {
14.            return View();
15.        }
16.    }
17.}

 

Here is my Detail.cshtml - for the Person tab

01.@model JustTestingWeb4.Models.Person
02. 
03.<div>
04.    <h4>Person</h4>
05.    <hr />
06.    <dl class="dl-horizontal">
07.        <dt>
08.            @Html.DisplayNameFor(model => model.FirstName)
09.        </dt>
10. 
11.        <dd>
12.            @Html.DisplayFor(model => model.FirstName)
13.        </dd>
14. 
15.        <dt>
16.            @Html.DisplayNameFor(model => model.LastName)
17.        </dt>
18. 
19.        <dd>
20.            @Html.DisplayFor(model => model.LastName)
21.        </dd>
22. 
23.        <dt>
24.            @Html.DisplayNameFor(model => model.Sex)
25.        </dt>
26. 
27.        <dd>
28.            @Html.DisplayFor(model => model.Sex)
29.        </dd>
30. 
31.        <dt>
32.            @Html.DisplayNameFor(model => model.Ssn)
33.        </dt>
34. 
35.        <dd>
36.            @Html.DisplayFor(model => model.Ssn)
37.        </dd>
38. 
39.        <dt>
40.            @Html.DisplayNameFor(model => model.PhoneNumber)
41.        </dt>
42. 
43.        <dd>
44.            @Html.DisplayFor(model => model.PhoneNumber)
45.        </dd>
46. 
47.    </dl>
48.</div>
49.<p>
50.    @Html.ActionLink("Edit", "Edit", "Person", new { id = 1 }, new { @class = "btn btn-primary", @style = "color:white; height:25px; width:35px; font-size: 0.99em; text-align:center" })
51.</p>

 

And here is my Edit.cshtml for  the - Person tab

01.@model JustTestingWeb4.Models.Person
02. 
03.@using (Html.BeginForm())
04.{
05.    @Html.AntiForgeryToken()
06.     
07.    <div class="form-horizontal">
08.        <h4>Person</h4>
09.        <hr />
10.        @Html.ValidationSummary(true, "", new { @class = "text-danger" })
11.        @Html.HiddenFor(model => model.PersonID)
12. 
13.        <div class="form-group">
14.            @Html.LabelFor(model => model.FirstName, htmlAttributes: new { @class = "control-label col-md-2" })
15.            <div class="col-md-10">
16.                @Html.EditorFor(model => model.FirstName, new { htmlAttributes = new { @class = "form-control" } })
17.                @Html.ValidationMessageFor(model => model.FirstName, "", new { @class = "text-danger" })
18.            </div>
19.        </div>
20. 
21.        <div class="form-group">
22.            @Html.LabelFor(model => model.LastName, htmlAttributes: new { @class = "control-label col-md-2" })
23.            <div class="col-md-10">
24.                @Html.EditorFor(model => model.LastName, new { htmlAttributes = new { @class = "form-control" } })
25.                @Html.ValidationMessageFor(model => model.LastName, "", new { @class = "text-danger" })
26.            </div>
27.        </div>
28. 
29.        <div class="form-group">
30.            @Html.LabelFor(model => model.Sex, htmlAttributes: new { @class = "control-label col-md-2" })
31.            <div class="col-md-10">
32.                @Html.EditorFor(model => model.Sex, new { htmlAttributes = new { @class = "form-control" } })
33.                @Html.ValidationMessageFor(model => model.Sex, "", new { @class = "text-danger" })
34.            </div>
35.        </div>
36. 
37.        <div class="form-group">
38.            @Html.LabelFor(model => model.Ssn, htmlAttributes: new { @class = "control-label col-md-2" })
39.            <div class="col-md-10">
40.                @Html.EditorFor(model => model.Ssn, new { htmlAttributes = new { @class = "form-control" } })
41.                @Html.ValidationMessageFor(model => model.Ssn, "", new { @class = "text-danger" })
42.            </div>
43.        </div>
44. 
45.        <div class="form-group">
46.            @Html.LabelFor(model => model.PhoneNumber, htmlAttributes: new { @class = "control-label col-md-2" })
47.            <div class="col-md-10">
48.                @Html.EditorFor(model => model.PhoneNumber, new { htmlAttributes = new { @class = "form-control" } })
49.                @Html.ValidationMessageFor(model => model.PhoneNumber, "", new { @class = "text-danger" })
50.            </div>
51.        </div>
52. 
53.        <div class="form-group">
54.            <div class="col-md-offset-2 col-md-10">
55.                <input type="submit" value="Save" class="btn btn-default" />
56.            </div>
57.        </div>
58.    </div>
59.}

 

And Finally here is my PersonController.cs

01.using JustTestingWeb4.Models;
02.using System.Web.Mvc;
03. 
04.namespace JustTestingWeb4.Controllers
05.{
06.    public class PersonController : Controller
07.    {
08.        public DbQuery db = new DbQuery();
09. 
10.        // GET: Person
11.        public ActionResult Index()
12.        {
13.            return View();
14.        }
15. 
16.        public PartialViewResult Detail(int id)
17.        {
18.            var result = db.GetPerson(id);
19.            return PartialView(result);
20.        }
21. 
22.        public PartialViewResult Edit(int? id)
23.        {
24.            var result = db.GetPerson(id);
25.            return PartialView(result);
26.        }
27. 
28.        [HttpPost]
29.        public PartialViewResult Edit([Bind(Include = "PersonID,FirstName,LastName,Sex,Ssn,PhoneNumber")] Person person)
30.        {
31. 
32. 
33.            var result = db.UpdatePerson(person);
34. 
35.            if (result == true)
36.            {
37.                var result1 = db.GetHouse(person.PersonID);
38.                return PartialView("Detail", result1);
39.            }
40. 
41. 
42.            return PartialView(person);
43.        }
44.    }
45.}

 

I have attached images to help explain what i am seeing. Thanks for your help.

Chinonso
Top achievements
Rank 1
 answered on 20 Jun 2017
11 answers
2.0K+ views
I have a form that has a couple of textboxes and the Kendo Upload control.  I also haven event on the submit button to ensure the textboxes have appropriate values in it, but how do I validate the upload?  Or IOW, how do I validate the user has actually selected a file before submitting the form?
Ivan Danchev
Telerik team
 answered on 20 Jun 2017
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
Security
ColorPicker
DateRangePicker
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
DropDownButton
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
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
LLM Kit
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?