Telerik Forums
UI for ASP.NET MVC Forum
4 answers
388 views
When placing an Editor in a Window the Editor control does not render correctly (tried this in IE 10, 9, 8 and FireFox)

We are using the latest verion of the MVC Wrappers: 2012.2.913.340

Below is an example from our code (Partial View)
@using (Ajax.BeginForm("AddComment", "Incident", new AjaxOptions { HttpMethod = "Post", OnSuccess = "onSuccess('AddWindow')" }))
{
    @Html.ValidationSummary(true)
 
    <div class="editor-field">
        @(Html.Kendo().EditorFor(model => model.Comment)
                .Name("Comment")
                .Tools(tool => tool
                    .Clear()
                    .Bold()
                    .Italic()
                    .Underline()
                    .InsertOrderedList()
                    .InsertUnorderedList()
                    .JustifyLeft()
                    .JustifyCenter()
                    .JustifyRight()
                    .JustifyFull()
                    .Indent()
                    .Outdent()
                    .CreateLink()
                                   .Unlink()))
        @Html.ValidationMessageFor(model => model.Comment)
    </div>
    @Html.HiddenFor(model => model.IncidentId)
    <p>
        <input type="submit" value="Add Comment" class="k-button" />
    </p>
}

On our Detail page:
@(Html.Kendo().Window()
           .Name("AddWindow")
           .Title("Add Comment")
           .Content(@<div>@Html.Partial("IncidentCommentAddPartial", Model.AddComment)</div>)
           .Draggable(true)
           .Modal(true)
           .Visible(false)
           .Width(625)
          )

Our onclick function for the window:
$('#addComment').click(function (e) {
            e.preventDefault();
            window.center().open();
        });

I have attached an image of how the partial view is being rendered in the Window
Dimo
Telerik team
 answered on 23 Nov 2012
0 answers
439 views
Folks
I had the same issue as Nick in this post:
http://www.kendoui.com/forums/mvc/editor/editor-in-window.aspx

I have found a solution that works
Firstly,  you must have the latest version on Kendo UI
You will need to have 2 views. one a partial view
The first view holds the button, the Kendo Window element and some javascript
The second holds the content that will appear in the window.

Here is the html for the first view
@model DnB.Connect.Mvc.Common.Models.CompanyModel
 
@( Html.Kendo().Window()
        .Name("DescriptionEdit")
        .Title("Edit Company Description")
        .HtmlAttributes(new { style = "width: 650px; height:600px;" })
        .Draggable(false)
        .Visible(false)
        .Resizable(resizing => resizing
            .Enabled(false)
        )
        .Modal(true)
           .Actions(a=>a.Close())
 )       
 
@Html.HiddenFor(m => m.Company.CompanyID, new { id = "CompanyID" })
<a id="ShowEditDescription" class="edit right">Edit</a>
So it has the button to be clicked, a hidden field to hold a Id and the KendoUI windows control.
Notice that the KendoUI control does not have a Content nor a LoadContentFrom method. I believe that having Content that contains a Kendo  Editor was as loading the another nested editor. I just could not get LoadContentFrom to work at all.

Once we click the button(I use css to style the link to a button), we get jQuery to do some work. Here is the javascript, which I put at the bottom of the above view

<script type="text/javascript">
       $(document).ready(function () {        
           $('#ShowEditDescription').click(function () {               
               var id = $("#CompanyID")[0].value;
               var param = { id: id };
               var sendwindow = $("#DescriptionEdit").data("kendoWindow");            
               if (sendwindow && sendwindow != undefined) {
                   sendwindow.center().open();
                   sendwindow.refresh({ url: "/Company/DisplayDescriptionEdit", data: param });
               }
           });
       });
</script>
I use jQuery to handle the link's click event.
inside that I get the Id from the hidden field
I build a parm array to hold the Id
I set a variable for the Kendo Window control
if it exists, I center it and open it
          then I refresh it with a call to the controller action, passing in the param array
                   the controller action does its thing and renders the partial view into the open window

Here is the html for the partial view that holds the Editor
@model CompanyModel
@if (Model != null && Model.Company != null  )
{   
        using (Html.BeginForm("DescriptionEdit", "Company", FormMethod.Post, new { @class = "nice",@style="width: 600px; height:550px;"}))
            {
                    <div class="row">
                        <div class="columns editing-section">
                            @(Html.Kendo().Editor()
                                          .Name("DescriptionEdit.CompanyDescription")                                                     
                                            .HtmlAttributes(new { style = "float: left; width: 600px; height:450px;" })
                                            .Encode(false)
                                            .Tools(tools => tools
                                                .Clear()
                                                .Bold().Italic().Underline()
                                                .FontName()
                                                .FontSize()
                                                .InsertUnorderedList()
                                                .InsertOrderedList()
                                                )
                                         )
 
                        </div>
                    </div>
                <div class="row">
                    <div class="two columns">
                        <input type="submit" value="Save" class="nice blue radius small button  middle5" />
                    </div>
                    <div class="two columns">
                        @Html.ActionLink("Cancel", "About", "Company", new { id = Model.Company.CompanyID }, new { @class = "nice blue radius small button middle5" })
                    </div>
                    <div class="eight columns"></div>
              </div>
    }
}
This view must be partial else you will get your default layout loaded as well. Also using a non-partial view disables the action controls on the Kendo Window.

In my struggle with this, I had to constantly delete the Temporary ASP.NET Files.
To do this, Close all instances of Visual Studio
Navigate to:     %windir%\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
Delete all items in that folder.

I hope this helps

Regards

Greg

Greg
Top achievements
Rank 1
 asked on 23 Nov 2012
2 answers
457 views
Hi,

I am looking to update an application that uses mvc3 and telerik mvc extensions to MVC 4. I am using this under the open source  GPL-v3 license  but it looks like this license has been removed from the KendoUI wrappers for MVC.

Am I to understand that there is no upgrade path for telerik mvc extensions under the GPL-v3 license?

Thanks,

Tim
Tim
Top achievements
Rank 1
 answered on 22 Nov 2012
5 answers
631 views
Tried the HtmlAttributes method on the mvc extensions for listview

@(Html.Kendo().ListView<ViewModel>()
.Name("listView")
.HtmlAttributes(new { @class = "some-class" }))

This does not set the class. Also tried "style" and nothing. Might be a bug.
Alex Gyoshev
Telerik team
 answered on 22 Nov 2012
5 answers
696 views
Following examples, I have a ListView I am trying to populate depending upon the selected values of two ComboBoxes. I got the ComboBoxes populated via DataSource fine but the ListView is giving me problems. Here is some illustrative code:
@(Html.Kendo().ListView<BusinessObject>()
      .Name("Equipment")
      .TagName("div")
      .ClientTemplateId("template")
      .DataSource(source => source.Read(read =>
          read.Action("ControllerAction", "Controller")
              .Data("additionalData")))
      .Pageable())
 
<script>
function additionalData() {
    return {
        first: $("#First").val(),
        second: $("#Second").val()
    };
}
</script>
 
public JsonResult ControllerAction(
    [DataSourceRequest]DataSourceRequest request,
    int first,
    int second)
{
    var sites = ServiceManager.SomeService
        .GetBusinessObjects(first, second)
        .ToDataSourceResult(request);
 
    var json = this.Json(sites, JsonRequestBehavior.AllowGet);
 
    return json;
}

I get a 404 (not found) for "Controller/ControllerAction". What am I doing wrong?

Is my whole approach valid?

The examples often show different ways of accomplishing the same thing, which is very confusing.

Thank you,
Richard

Nikolay Rusev
Telerik team
 answered on 22 Nov 2012
0 answers
142 views
Hi,

I would like to know that can we add two add buttons on top of the grid .

In my grid i would like to show two different products for e.g., Product A , Product B

when i click on the first button(Add Product A) i would like to open Product A Popup
on click of second button open Product B Popup

Same thing i want to apply for edit button inside the grid,
 based on the Product type i would like to open Product A popup, and Product B popup


Can any one suggest me the better approach.

Thanks
vani
Top achievements
Rank 1
 asked on 22 Nov 2012
11 answers
607 views
Hi,

We today tried switching to the .less version of the Kendo styles to be able to use themebuilder colors elsewhere in our project as well, however we cannot get it to work.

We use DotLess to compile the .less files, however the @require lines seems to fail. Do you have any guidance on how to get this working or a sample project with it working? Our own less files works well, however they do not contain any require statemend, just some variables, mixins and nesting.

Thanks
/Victor
Jaap
Top achievements
Rank 2
 answered on 22 Nov 2012
0 answers
232 views
Hello,

when I'm using the CustomCommand grid, my grid is always empty.
If I'm looking through the generated scriptcode with firebug the url attribute contains ="Controller/action". (Grid/CustomCommand_Read)

But my current page url calls http://localhost:53850/Tickets

Because of the relative url it always calls http://localhost:53850/Tickets/Grid/CustomCommand_read. Is this correct?
If it is so i dont know how to use it with the root url (http://localhost:53850/ + Grid/CustomCommand_Read)

The debugger also doesn't call the CustomCommad_Read. Only if I'm calling the correct url directly.

Thanks a lot.

Kind Regards

Phillip
Phillip
Top achievements
Rank 1
 asked on 22 Nov 2012
1 answer
320 views
Hello,

I have a grid that is bound to a model with nullable types (a bunch of "decimal?" types representing currency, to be exact). It is using a popup for editing. The editor template I am using for the popup hides some of these fields by default and only shows them if certain conditions are met based on other inputs.

At first, I would try to add an item to the grid and it didn't work--the popup wouldn't even close. Then I realized it was because these hidden currency fields were empty, and it was showing a validation message. The properties that are having this issue are not marked as [Required]. 

I've been trying for hours to find a solution to this problem that makes it so these fields are allowed to be null, or to specify some kind of default value.

If needed I can post a sample project. Any ideas?
Ryan
Top achievements
Rank 1
 answered on 21 Nov 2012
1 answer
267 views
I have the following .chtml, view model, and controller actions.  However, the auto complete never displays any results even though I can see that the Jason results are sent back to the browser. 

.chtml
@model IEnumerable<Trishulla.Erp.Web.Core.Main.Models.CustomerNameModel>
@{
    ViewBag.Title = "New Appointment";
}
<section class="contentTile">
        New Appointment
</section>
@section navigation{
        @Html.Partial("_DailyServiceLeftNav")
}


@(Html.Kendo().AutoComplete()
          .Name("CustomersAutoComplete")
          .BindTo(Model)
          .Suggest(true)
          .DataTextField("Name")          
          .Filter(FilterType.StartsWith)
          .Placeholder("Customers...")
          .DataSource(source =>
                          {                              
                              source.Read(read =>
                                              {
                                                  read.Action("GetActiveCustomers", "DailyService");
                                              }).ServerFiltering(true);
                          })                                 
)


View Model:
public class CustomerNameModel
    {
        public int Id { get; set; }
        public string Name { get; set; }
}

Controller actions:
 public ActionResult NewAppointment()
        {
            IEnumerable<CustomerNameModel> customerModel = this.customerService.CustomerRepository.GetMany(c => c.IsActive)
                                            .Select(c => new CustomerNameModel
                                            {
                                                Id = c.Id,
                                                Name = string.Format("{0} {1}", c.FirstName, c.LastName)                                               
                                            });


            return View(customerModel.ToList());
        }


        [HttpGet]
        public ActionResult GetActiveCustomers([DataSourceRequest] DataSourceRequest request)
        {
            string searchValue = Request.Params["filter[filters][0][value]"];
            IEnumerable<CustomerNameModel> customerModel = this.customerService.CustomerRepository.GetMany(c => c.IsActive)
                                            .Select(c => new CustomerNameModel
                                            {
                                                Id = c.Id,
                                                Name = string.Format("{0} {1}", c.FirstName, c.LastName)
                                            });


            var returnVal = Json(customerModel.Where(c => c.Name.StartsWith(searchValue, StringComparison.InvariantCultureIgnoreCase)).ToList().ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
            return returnVal;
        }
Georgi Krustev
Telerik team
 answered on 21 Nov 2012
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
MultiColumnComboBox
Dialog
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
SegmentedControl
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?