Telerik Forums
UI for ASP.NET MVC Forum
6 answers
820 views

I've got the following code which doesn't seem to render correctly, it moves the fields outside of the form, so the form is an empty tag. I tried adding .Render() to both tabstrip and window at different times and gained a .NET error

"CS1502: The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)' has some invalid arguments "

@(Html.Kendo().TabStrip()
          .Name("tabstrip")
          .Items(tabstrip =>
          {
 
@*More tabs*@
                 tabstrip.Add().Text("Create New Task")
                  .Content(
                @<text>
                    @using (Ajax.BeginForm(null, null, new AjaxOptions { Url = Url.Action("UserAddNewTask", "ProjectApi", new { area = "API" }), OnSuccess = "CloseAndRefreshTaskGrid()" }, new { @id = "newTaskForm" }))
                        {
                        @Html.Hidden("Id")
  
                        <div class="container-fluid">
                            @*More fields*@
  
                            <div class="row top10">
                                @Html.Label("Task Name", new { })
                                @Html.Kendo().TextBoxFor(model => model.Name)
                                @Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" })
                            </div>
  
                            <div class="row top10">
                                <button class="btn btn-success" id="btnNewTaskSubmit" type="submit">Submit</button>
                            </div>
                        </div>
                        }
  
                </text>);
          }))

@(Html.Kendo().TabStrip()
          .Name("tabstrip")
          .Items(tabstrip =>
          {
                 tabstrip.Add().Text("Create New Task")
                  .Content(
                @<text>
                    @using (Ajax.BeginForm(null, null, new AjaxOptions { Url = Url.Action("UserAddNewTask", "ProjectApi", new { area = "API" }), OnSuccess = "CloseAndRefreshTaskGrid()" }, new { @id = "newTaskForm" }))
                        {
                        @Html.Hidden("Id")
 
                        <div class="container-fluid">
                            @*More fields*@
 
                            <div class="row top10">
                                @Html.Label("Task Name", new { })
                                @Html.Kendo().TextBoxFor(model => model.Name)
                                @Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" })
                            </div>
 
                            <div class="row top10">
                                <button class="btn btn-success" id="btnNewTaskSubmit" type="submit">Submit</button>
                            </div>
                        </div>
                        }
 
                </text>);
          }))

@(Html.Kendo().Window()
    .Name("editTaskModal")
    .Modal(true)
    .Draggable()
    .Actions(a => a.Pin().Maximize().Minimize().Close())
    .Title("Edit Task")
    .Width(800)
    .Visible(false)
    .Position(p => p.Top(150))
    //.Content(@Partial/_TimesheetNewTask")
    .Content(@<text>@Html.Partial("Partial/_TimesheetNewTask")</text>)
)

Daniel
Telerik team
 answered on 21 Apr 2015
3 answers
967 views
Hi,

In my project, I need to put some forms in kendo windows. These forms are in other partial view. I use this to load the partial view :

01.@(Html.Kendo().Window()
02.         .Name("editPasswordPopUp")
03.         .Visible(false)
04.        .Modal(true)
05.        .Width(600)
06.        .Height(500)
07.       .Position(settings =>
08.               settings.Top(70).Left(200))
09.         .Title("Edit your password")
10.         .Content("loading user info...")
11.        .LoadContentFrom("EditPassword", "Member")
12.         .Iframe(true)
13.         .Resizable()
14.         .Draggable()
15.         )

1.public ActionResult EditPassword() {
2.    return PartialView();
3.}

1.[HttpPost]
2.[ValidateAntiForgeryToken]
3.public ActionResult EditPassword(EditPasswordViewModel viewModel)
4.{
5.     [....]
6.     return RedirectToAction("Profile", "Member", new {id = viewModel.Id});
7.     [....]
8.}

And here is my PartialView :
01.@using Devoteam.CustomerPortal.Application.Helpers
02.@model Devoteam.CustomerPortal.ViewModels.EditPasswordViewModel
03.@{
04.    ViewBag.Title = "Edit";
05.    Layout = null;
06.}
07. 
08.@Styles.Render("~/Content/css")
09.@Scripts.Render("~/bundles/jquery")
10.@Scripts.Render("~/bundles/jqueryval")
11.@Scripts.Render("~/bundles/kendo")
12. 
13.@using (Html.BeginForm())
14.{
15.    @Html.AntiForgeryToken()
16. 
17.    <div id="messageError">
18.        @Html.ValidationSummary()
19.    </div>
20.  [...] // Fields
21.     
22.    <div class="buttons">
23.        <input type="submit" value="Confirm" class="big-button" />
24.        <input type="submit" value="Cancel" class="big-button" />
25.    </div>
26.}


When I click on the button to open the kendo window, the partial view load correctly in it.
When I submit my form, the action is correctly called. Here is my problem : when the controller has done his job, I call a RedirectToAction to redirect the user. But the page is loaded in the kendo window instead of the main window. Is there any solution to close the kendo window ?

Second question : how to close the kendo window when pressing the cancel button.


Thank you.
Alexander Popov
Telerik team
 answered on 21 Apr 2015
3 answers
313 views
Hi, I trying to add a custom delete command on the toolbar and I need to get the selected row and data. I'm using Server binding and I tried using some of the answers in the forum but it still didn't work.

function deleteCommand(e) {
    var grid = $('#reimbursementsGrid').data('kendoGrid');
    var rows = grid.select();
    rows.each(
        function () {
            var record = $(this).data();
            alert('Selected : ' + record.Id);
 
        }
    )
}
The alert is always showing undefined. Can someone please point me in the right direction please?

The Id is defined in the model and is a hidden column
@(Html.Kendo().Grid(Model)
        .Name("reimbursementsGrid")
        .DataSource(dataSource => dataSource
            .Server()
            .Model(model =>
            {
                model.Id(r => r.Id);

...
        .Columns(columns =>
        {
            columns.Bound(o => o.Id).Hidden(true);
...
Stu
Top achievements
Rank 1
 answered on 20 Apr 2015
2 answers
67 views

Picture of the chart: http://i.imgur.com/K88FEJd.png

 

I cannot get the chart to do categories correctly. If you look at the dates in the following data they are all different except if it is a different department. But in the picture they seem to merge for some reason. Can someone explain this?

Here is my return JSON data...

[{"DepartmentName":"Information Technology","TicketDate":"2015-04-01","TicketCt":3},{"DepartmentName":"Information Technology","TicketDate":"2015-04-16","TicketCt":1},{"DepartmentName":"Human Resources","TicketDate":"2015-04-14","TicketCt":1},{"DepartmentName":"Human Resources","TicketDate":"2015-04-15","TicketCt":1}]

 Here is my code:

@(Html.Kendo().Chart<Guardian.ViewModels.TicketCount>()
                          .Name("LastTwoWeeks_Tickets")
                          .Title("Ticket Count In The Past 30 Days")
                          .Legend(legend => legend
                              .Position(ChartLegendPosition.Top)
                          )
                          .DataSource(ds => ds.Read(read => read
                              .Action("_NewTicketCtOverTwoWeeks_Read", "Home"))
                              .Group(group => group.Add(model => model.DepartmentName))
                              .Sort(sort => sort.Add(model => model.TicketDate).Ascending())
                          )
                          .Series(series => series.Line(model => model.TicketCt).Name("#= group.value #"))
                          .CategoryAxis(axis => axis
                              .Categories(model => model.TicketDate)
                          )
                          .ValueAxis(axis => axis.Numeric()
                              .Labels(labels => labels.Format("{0:N0}"))
                          )
                          .Tooltip(tooltip => tooltip
                              .Visible(true)
                              .Shared(true)
                              .Format("{0:N0}")
                          )
                    )

 

 

Joshua
Top achievements
Rank 2
 answered on 20 Apr 2015
2 answers
100 views
Greetings.

I had some sort of problems trying to attach my tests so I upload them to wetransfer so you can download them.
On the following link, you will find 2 projects: a WPF and MVC one.   http://bit.ly/1zigHWP


The point is to load and export documents between WPF RadRichTextBoxRichText and MVC Editor.
This is what simulate our enterprise softwares.

 

In the WPF test app, we have a file test.txt with a hexadecimal code of a document created in our WPF application's RadRichTextBoxRichText. 
If you click on the button "Import" you can see the original formatations. Then, if you click the button "Export" you will convert that doc to hexadecimal and copy it to the clipboard so you can past on the MVC test app.

 

In the MVC test app, you can past that hexadecimal code clicking on "Past Hex" button, and you will see that the document was imported well succeded with all formatations.

I guess the main problem begin in the WEB app. 

First problem:
If I export the document to hexadecimal from the MVC editor, clicking on " Get Hex" button, and copy that again using the button "Past Hex", you will realise that you lost all the spaces between lines.

Second problem:
To replicate the following problem, please, follow these steps:
1 - Click "Import From test.txt"
2 - Edit the line where it begins with  "No estudo efectuado não..." , delete the rest of that line leaving just that words, and apply a background color to them.
3 - Justify that words.
4 - Click "Get Hex" and copy the hex code written on the footer.
5 - Replace the hexadecimal code in test.txt in WPF application with the copied hexadecimal.
6 - Run the WPF app and click "Import"

Now, if you look, you can see that:
       The justified line is with extra spaces, 
       All the spaces between lines have been lost, 
       There is no background color on the justified line.



I apreciate the solution for these problems so that we can find a better way to import the documents in both technologies without any lost.
Regards.

Alexander Popov
Telerik team
 answered on 20 Apr 2015
1 answer
513 views

I have scoured the forums and following all of the instructions to try to get the DropDownlist to properly behave. What I am doing is using a wizard (in Jquery) form and each time the next button is called the following code is hit:

if (wizardForm.valid()) {// validate the form
   wizardForm.validate().focusInvalid();
.............}

The problem is when I change the ignore option to "", from ignore: ":hidden" the validation looks like it is successful and without validation errors however the next button does not advance to the next page. 

 

I have also tried the example from the "KendoInputs_Validation" project but that does not work at all in Visual Studio.

Vladimir Iliev
Telerik team
 answered on 20 Apr 2015
1 answer
164 views

Hi,



Is there a way to use Kendo().Menu() with complex
ItemDataBound ?

While creating simple menu with several menu option &
several children’s is ok, I did not managed to understand how to implement menu
item with several children & images & dropdown list & buttons.

In the attached image you will find the best explanation in
order to understand what I want I've attached an image

 

Thanks

Georgi Krustev
Telerik team
 answered on 20 Apr 2015
1 answer
1.2K+ views

Hello,

I have a grid with the filterMenuInit event set up to fire a custom function. However, the event is not firing when I open the filter menu. Here is some of the code for the grid:

 @(Html.Kendo().Grid(Model)
        .Name("Grid")
        .ColumnMenu()
        .Columns(columns =>
        {
            columns.Bound(m => m.Number)
                .Title("Number")
                .Width(140)
                .Filterable(ftb => ftb.Cell(cell => cell.ShowOperators(true).Template("NumberFilter")));
            columns.Bound(m => m.FirstName)
                .Title("First Name")
                .Width(140)
                .Filterable(ftb => ftb.Cell(cell => cell.Delay(@serverSideDelay).ShowOperators(true)));
            columns.Bound(m => m.LastName)
                .Title("Last Name")
                .Width(140)
                .Filterable(ftb => ftb.Cell(cell => cell.Delay(@serverSideDelay).ShowOperators(true));
        })
        .Pageable(pageable => pageable
                .Refresh(true)
                .ButtonCount(10))
        .ColumnMenu(menu =>
        {
            menu.Filterable(false);
            menu.Columns(false);
        })
        .Sortable(s => s
            .AllowUnsort(false)
            .SortMode(GridSortMode.SingleColumn))
        .Selectable()
        .EnableCustomBinding(true)
        .Events(e => e.FilterMenuInit("hideFilter"))
        .Filterable(ftb => ftb.Mode(GridFilterMode.Row))
        .DataSource(dataSource => dataSource
            .Ajax()
            .Model(model => model.Id(m => m.ID))
            .Sort(s =>
            {
                s.Add("LastName").Ascending();
            })
            .PageSize(10)
            .ServerOperation((bool)@ViewBag.IsServerSide)
            .Read(read => read.Action("ReadAction"))
            .Total((int)ViewBag.Count)
            .Events(events => events.Error("onKendoDataSourceError").RequestStart("checkFilter"))
        )
        .Events(e => e.Change("selectObject").DataBound("checkFilter"))
    )

 

I'm using version 2014.3.1316. Can you please help with this? Thanks.

Dimiter Madjarov
Telerik team
 answered on 17 Apr 2015
1 answer
121 views

Hi,

I have a custom class with a few strings and a list My grid is bound to a collection of my custom class and one of the columns is for the list.count. When the Grid renders, the column is empty. When reviewing the html code for the Grid, I discovered that the object type of list.count is now "object", see below:

{"Provider":{"type":"string"},"Type":{"type":"string"},"Bills":{"type":"object"}

 Where bills is a List<>. 

Alexander Popov
Telerik team
 answered on 17 Apr 2015
1 answer
273 views
Hi everyone,

I've created a  Grid Hierarchy here..I was able to get the column values from my Parent Grid(CustomerGrid) to use it on a ClientTemplate for example 

(@Html.ActionLink("Add Order", "AddOrder", "Customer", new { customerId = "#= CustomerId#" }, null).ToHtmlString()). 

But when I'm trying to adapt this kind of code, now getting the customerOrderId field from my Child Grid and use it on my ClientTemplate for example 

(@Html.ActionLink(AmsStrings.LabelEditAmendment, "EditOrder", "CustomerOrder", new { orderId = "#= OrderId#" }, null).ToHtmlString())

 I've retrieved nothing from here.The later code was used inside the Child Grid? What is wrong with my code? Why is it column values from my Parent Grid are available for use on my ClientTemplate while column values on my Child Grid are not available for use? 

 

@(Html.Kendo().Grid<customerviewmodel>
()
.Name("CustomerGrid")
.Columns(columns =>
{
columns.Bound(item => item.CustomerId).Hidden(true);
columns.Bound(item => item.Name);
columns.Template(t => { })
.Title("")
.Width(120)
.ClientTemplate("<div class='btn-group'>
    " +
    "<a class='btn btn-default btn-sm dropdown-toggle' data-toggle='dropdown'> Action <span class='caret'></span></a>" +
    "<ul class='dropdown-menu'>
        " +
        "
        <li>" + (@Html.ActionLink("Add Order", "AddOrder", "Customer", new { customerId = "#= CustomerId#" }, null).ToHtmlString()) + "</li>" +
        "
    </ul>
</div>");
 
})
.Selectable(selectable =>
{
selectable.Enabled(true);
selectable.Mode(GridSelectionMode.Single);
})
.ClientDetailTemplateId("template")
.DataSource(datasource => datasource.Ajax()
.Model(model =>
{
model.Id(m => m.CustomerId);
})
.Read(read => read.Action("CustomerDataSource", "Customer")))
.Sortable())
 
 
 
<script id="template" type="text/x-kendo-template">
    @(Html.Kendo().Grid
    <CustomerOrderViewModel>
        ()
        .Name("grid_#=CustomerId#")
        .Columns(columns =>
        {
        columns.Bound(item => item.OrderId).Hidden(true);
        columns.Bound(item => item.OrderName);
        columns.Template(@<text></text>)
        .Title("")
        .Width(100)
        .ClientTemplate("<div class='btn-group'>
            " +
            "<a class='btn btn-default btn-sm dropdown-toggle' data-toggle='dropdown'>Action<span class='caret'></span></a>" +
            "<ul class='dropdown-menu'>
                " +
                "
                <li>" + (@Html.ActionLink("Edit", "EditOrder", "CustomerOrder", new { orderId = "#= OrderId#" }, null).ToHtmlString()) + "</li>" +
                "
                <li>" + (@Html.ActionLink("View", "ViewOrder", "CustomerOrder", new { orderId = "#= OrderId#" }, null).ToHtmlString()) + "</li>" +
 
                "
            </ul>
        </div>");
 
        })
 
        .Editable(editable => editable.Enabled(false))
        .Sortable()
        .Selectable(selectable =>
        {
        selectable.Enabled(true);
        selectable.Mode(GridSelectionMode.Single);
        })
        .DataSource(datasource => datasource
        .Ajax()
        .ServerOperation(false)
        .PageSize(5)
        .Model(model => model.Id(p => p.OrderId))
        .Read(read => read.Action("CustomerOrderDataSource", "CustomerOrder", new { customerOrderId = "#=customerId#" })))
        .ToClientTemplate())
 
 
 
</script>
Nikolay Rusev
Telerik team
 answered on 17 Apr 2015
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?