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

Scenario:
From SharePoint site ribbon icon click opens a dialog window and loads View1.
On View1 a button click navigates to View2.
On View2 a button click should navigate back to View1.

Problem: The Forward navigation is working fine with the href below

window.location.href = '@Url.Action("Index", "Tab")';

But the backward navigation is not working. I have two different Controllers [HomeController, TabController]

<div class="k-closeDiv">
        @(Html.Kendo().Button()
        .Name("closeButton")
        .Content("Close")
        .HtmlAttributes(new { type = "button" })
        .Events(e => e.Click("onCloseButtonClick"))
        )
    </div>
 
 function onCloseButtonClick() {
        window.location.href = '@Url.Action("Index", "Home")'; //NotWorking..??
    }

I have tried all the available options below.

  1. Here
  2. RedirectToAction("Action","Controller")
  3. RedirectToRoute("routeName") 

No errors but No option is working.

Is this an issue since I am loading views in dialog window.??

Please suggest. Thanks

 

 

T. Tsonev
Telerik team
 answered on 30 Nov 2016
9 answers
1.2K+ views

We have a server in UK, and our clients are in US with different timezones.

 

In a grid, we set up a datetime field with default value as datetime.now in the cshtml view file. However, we found the issues:

 

1. The datetime.now is server datetime, not client datetime, so it is always wrong. how can we use the users datetime value?

 

2. we have tried using onsave event with gridrow.isnew() to set client's default value. however, if the user change the value, the isnew() is still return true which overwrites user's  new input.

 

Thanks

Viktor Tachev
Telerik team
 answered on 30 Nov 2016
1 answer
1.7K+ views

I have a grid in a cleintTemplate with a checkbox column, as below,  in a single grod with checkbox, the click event is firedt using the class, but when the grid is inside a clientTemplate column the same way does not work.  Ive tried various ways, but cant seem to get this checkbox to fire a click event.

What extra is required for the checkbox in a grid inside a cleinttemplate column.

 

Thanks

@(Html.Kendo().Grid<WebSite.Library.Models.SiteCriteria>()
.Name("siteCriteriaCriteria")
.HtmlAttributes(new { style= "height:60vh; " })
.Scrollable()
.Columns(columns =>
{
columns.Bound(p => p.siteId).Title("siteId").Width(50).Hidden();
//columns.Bound(p => p.premiseAreaId).Title("premiseId").Width(50).Hidden();
columns.Bound(p => p.areaId).Title("AreaId").Width(50).Hidden();
columns.Bound(p => p.name).Title("Hazard Area").Width(150);
columns.Template(p => "").HtmlAttributes(new { @class = "templateCell" }).Title("criteria").Width(200).ClientTemplate(
Html.Kendo().Grid<WebSite.Library.Models.SiteCriteria>()
.Name("areaCriteria_#=areaId#")
.TableHtmlAttributes(new { @class = "GridNoHeader" })
.Columns(c =>
{
c.Bound(e1 => e1.name).Title("Training").Width(150).HeaderHtmlAttributes(new { style = "display:none;" }).HtmlAttributes(new { style = "height: 15px" });
c.Bound(e1 => e1.areaId).Title("Area").Width(100).Hidden();
c.Bound(e1 => e1.siteCriteria).Title("Access Criteria").ClientTemplate("<input type='checkbox' #=siteCriteria# ' # class='chkbx' />").HtmlAttributes(new { style="height: 15px" }).HeaderHtmlAttributes(new { style="display:none;" }); ;
})
.Events(events=> events.DataBound("siteCriteriaCriteria_onDataBound"))
.DataSource(source1 => source1
.Custom()
.Transport(transport => transport
.Read(read =>
{
read.Url("/Api/SiteInfo/_getTrainingAreas/_si=" + Model.SiteId)
.DataType("json");
})

))
.ToClientTemplate().ToHtmlString()
);
// columns.Command(command => { command.Edit(); }).Width(250);
})
.Events(events => events.Save("onSave").DataBound("hideEditCommand"))
.NoRecords("No criteria exists.")
.ToolBar(toolbar => toolbar.Create())
.Editable(editable => editable.Mode(GridEditMode.InLine))
.DataSource(source => source
.Custom()
.Schema(schema => schema
.Model(m => m.Id(p => p.siteId)))
.Transport(transport => transport
.Read(read =>
{
read.Url("/Api/SiteInfo/_getPremiseArea/_si=" + Model.SiteId )
.DataType("json");
})
))
)

 

 

 

JAVASCRIPT

$('#areaCriteria_').on("click", ".chkbx", function (e) {
alert("Click Occurred");
});

Eyup
Telerik team
 answered on 30 Nov 2016
3 answers
2.5K+ views

Hi,

I've almost over 200+ grids in my app. I am trying to add a external search area to search in all columns

 

$('.k-grid').each(function () {
            var $gridElement = $(this);
            var $grid = $gridElement.data('kendoGrid');

            var toolbar = $grid.table.prev('.k-grid-toolbar');
            if (toolbar.length > 0)
            {
                var searchContainer = $('<div style="width: 200px; float:right;"></div>').appendTo(toolbar);
                var searchBox = $('<input type="text" class="form-control"/>')
                    .appendTo(searchContainer)
                    .on('keyup', function () {
                        var val = $(this).val();

                        var filters = [];
                        $.each($grid.columns, function (i, item) {
                            if(item.field && item.field.length > 0)
                            {
                                filters.push({ field: item.field, operator: 'contains', value: val })
                            }
                        });
                        $grid.dataSource.filter({
                            logic: "or",
                            filters: filters
                        });
                    });
            }

....................

 

But I've two problems:

    1) It does filtering in server-side, I want to make it in client-side.

    2) Because I'm binding some columns with SelectLists, I cannot search amoung them. 

 

Do you have any suggestions?

Regards.

Danail Vasilev
Telerik team
 answered on 29 Nov 2016
5 answers
1.6K+ views

Hi,
I configured the Kendo MultiSelect for ajax binding, I send parameters to the server, All as described in
http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/multiselect/overview#sending-parameters-to-the-server
Everything works fine except my call to the refresh method (http://docs.kendoui.com/api/web/multiselect).
The thing is that a new ajax request does not occur when I call refresh (is it by design? should I use another API?),
I need the List Of Values to be updated by a new Ajax call on change of another control.
The parameters I send to the server are

1. the text typed
2. a value of another control

Thanks in advanced,

Lauri

 

 

Georgi Krustev
Telerik team
 answered on 29 Nov 2016
8 answers
245 views

Reading the docs on the scaffolder (http://docs.telerik.com/kendo-ui/aspnet-mvc/scaffolding) shows the dialog appearing when Add | New Scaffolded Item is selected, which is fine.

Unfortunately when I pick Add | Controller I still get the Kendo UI Scaffolder dialog when all I want is a plain MVC controller.

How can I fix this behaviour?

Matt
Top achievements
Rank 1
 answered on 29 Nov 2016
1 answer
399 views

Dear,

We have tried to add autocomplete dynamically from partial view with Ajax.ActionLink, but they do not initialize, and not working.
We also managed to use different id-s on the inputs, but we standardize the name for achive out goal:

Dynamic load of partial view:
  @Html.Partial("_Teszt", Model)
        <div id="tobbSpecEszkoDiv">
        </div>
        @Ajax.ActionLink(
            "Új",
            "_Teszt",
            "Home",
            new AjaxOptions
            {
                UpdateTargetId = "tobbSpecEszkoDiv",
                InsertionMode = InsertionMode.InsertAfter,
                OnSuccess = "korteLo"
            })

<script language="javascript">
    function korteLo(e) {
        $("input[id^='countries']").attr('name', 'countries');;
    }
</script>

 

PartialView:

@using Kendo.Mvc.UI
@(Html.Kendo().AutoComplete()
          .Name("countries"+DateTime.Now.Millisecond)
          .Filter("startswith")
          .Placeholder("Select country...")
          .BindTo(new string[] {
                "Albania",
                "Andorra",
                "Armenia",
                "Austria",
                "Azerbaijan",
                "Belarus",
                "Belgium",
          })
          .Separator(", ")
      )

 

For further details we attached the project files.

 

Best regards.

Anton
Telerik team
 answered on 28 Nov 2016
4 answers
364 views

Hi,

I'm trying to implement a custom command on my grid, which is using server binding, but the button just leads to a 'resource not found' error. My routing looks as it should and I can't see anything else wrong. I should also say that the MVC stuff is actually implemented in an 'area'. All my code is below, could anyone help?

Routing

1.context.MapRoute(
2.   "ControlPanel_default",
3.   "ControlPanel/{controller}/{action}/{id}",
4.   new { action = "Index", id = UrlParameter.Optional }
5.);

Index.cshtml

01.@(Html.Kendo().Grid(Model)
02.    .Name("Grid")
03.    .Columns(col =>
04.    {
05.        col.Bound(p => p.CustomerId);
06.        col.Bound(p => p.aspNetUserID);
07.        col.Command(cmd =>
08.        {
09.            cmd.Edit();
10.            cmd.Custom("Test").Action("Lockout", "Index");
11.        });
12.    })
13.    .Editable(edt => edt.Mode(GridEditMode.PopUp))
14.    .Pageable()
15.    .Sortable()
16.    .Scrollable()
17.    .DataSource(ds => ds
18.    .Server()
19.    .Model(mdl => mdl.Id(p => p.CustomerId))
20.    .Read("Index","Index")
21.    .Update("Update","Index")
22.    .Create("Create","Index")
23.    .Destroy("Destroy","Index"))
24.    )

 

IndexController.cs

01.public class IndexController : Controller
02.{
03.   public ActionResult Index()
04.   {
05.      ViewBag.Title = "Home";
06.      return View(GetCustomers());
07.   }
08.   public ActionResult Lockout(int CustomerId)
09.   {
10.      if (ModelState.IsValid)
11.      {
12.         //var result = CustomerId;
13.         RouteValueDictionary routeValues = this.GridRouteValues();
14.         return RedirectToAction("Index", routeValues);
15.      }
16.      return View("Index");
17.   }
18.}
Steve
Top achievements
Rank 1
 answered on 28 Nov 2016
3 answers
649 views

Hi,

I'm using a AutoComplete in my form (Grid Popup Editor template) and all the Validation works except that on the AutoComplete...(see Picture)

here is the Code for the AutoCompleteFor:

<div class="form-group m-xs">
                    <label class="col-sm-2 control-label">Postleitzahl:</label>
                    <div class="col-sm-2">
                        @(Html.Kendo().AutoCompleteFor(m => m.Postleitzahl)
                            .DataTextField("Postleitzahl_ID")
                            .Filter(FilterType.StartsWith).MinLength(1)
                            .NoDataTemplate("Keine Postleitzahl gefunden")
                            .Suggest(true)
                            .Height(300)
                            
                            .DataSource(source =>
                            {
                                source.Read(read =>
                                {
                                    read.Action("Postleitzahl_Read", "Standorte")
                                        .Data("onAdditionalData");
                                })
                                    .ServerFiltering(true);
                            })
                            .Events(e => e
                                .Select("onPostleitzahlSelect")
                            ))
                        @Html.ValidationMessageFor(model => model.Postleitzahl)
                </div>

 

here the part of the model class:

[Required]
[StringLength(8)]
public string Postleitzahl { get; set; }
[Required]
[StringLength(65)]
public string Ort { get; set; }
[Required]
[StringLength(255)]
Peter Milchev
Telerik team
 answered on 25 Nov 2016
7 answers
248 views

Hi,

We allow users to change the the value in each cells. However, the user doesn't like to see the width changes from displaying text to a textbox mode. Is there any way we can stop it so we keep the same width for the displaying text and textbox?

 

thanks!

Eyup
Telerik team
 answered on 25 Nov 2016
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
Upload
ComboBox
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
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
ListView (Mobile)
Pager
Accessibility
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
MediaPlayer
TileLayout
DateInput
Drawer
SplitView
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Template
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
Licensing
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
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?