Telerik Forums
UI for ASP.NET MVC Forum
0 answers
194 views
Found my answer here

I have declared the following in my Login.cshtml file.  Everything displays and accepts user input correctly.  However, the form submit button does nothing.  Is there a way to get it to work?

@model LoginModel

@{
    ViewBag.Title = "Login";
}

@(Html.Kendo().MobileView()
    .Name("view-login")
    .Title("Login")
    .Header(obj =>
        (Html.Kendo().MobileNavBar()
                .Name("nav")
                .Content(navbar =>
                    @<text>
                    @navbar.ViewTitle("")
                    </text>
                )
            )
        )
    .Content(
        @<text>
        @LoginForm()
        </text>
    )
    )
)

@helper LoginForm()
    {
    <section id="loginForm">
    @using (Html.BeginForm())
    {
        @Html.AntiForgeryToken()
        @Html.ValidationSummary(true)

        <fieldset>
            <legend>Log in Form</legend>
            <ol>
                <li>
                    @Html.LabelFor(m => m.UserName)
                    @Html.TextBoxFor(m => m.UserName)
                    @Html.ValidationMessageFor(m => m.UserName)
                </li>
                <li>
                    @Html.LabelFor(m => m.CompanyCode)
                    @Html.TextBoxFor(m => m.CompanyCode)
                    @Html.ValidationMessageFor(m => m.CompanyCode)
                </li>
                <li>
                    @Html.LabelFor(m => m.Password)
                    @Html.PasswordFor(m => m.Password)
                    @Html.ValidationMessageFor(m => m.Password)
                </li>
                <li>
                    @Html.CheckBoxFor(m => m.RememberMe)
                    @Html.LabelFor(m => m.RememberMe, new { @class = "checkbox" })
                </li>
            </ol>
            <input type="submit" value="Log in" />
        </fieldset>
    }
    </section>
}

@(Html.Kendo().MobileApplication()
    .ServerNavigation(true)
)

ADDITIONAL NOTES:

I determined that the cause of the malfunctioning Login button is the fact that the form produced by BeginForm is empty and reads as such:

<form action="/Account/Login" method="post"></form>

Any ideas why the form is coming up empty?
Steven
Top achievements
Rank 1
 asked on 26 Aug 2013
4 answers
348 views
Hi,

As a part of a report I have a chart that displays both negative and positive values (see attachment), which seems to work fine :) However, I need to place the axis labels at the bottom, and not in the center (0) as they are right now. I came across an older post saying that this was not possible at that time (around mid to late 2012), but I was hoping this was sorted by now?

Here's my chart code:
@(Html.Kendo().Chart()
      .Name("chart")
      .Theme("silver")
      .Legend(legend => legend.Visible(false))
      .ChartArea(chartArea => chartArea
                                  .Background("transparent")
      )
      .Series(series =>
          {
              series.Area(@Model.Weight).Name("Weight");
          })
      .ValueAxis(axis => axis
                             .Numeric("depth")
                             .Labels(labels => labels.Format("{0}kN"))
                             .AxisCrossingValue(0)
                             .Line(line => line.Visible(false))
                              
      )
      .CategoryAxis(axis => axis
                                .AxisCrossingValue(0,0,0,10)
                                .Categories(@Model.Depth)
                                .MajorGridLines(lines => lines.Visible(true))
      )
      .Tooltip(tooltip => tooltip
                              .Visible(true)
                              .Format("{0}%")
                              .Template("#= series.name #: #= value #")
      )
      )
If this is still not supported, I'd greatly appreciate a possible workaround as this is much needed functionality :)
Thanks in advance!
Ian
Top achievements
Rank 2
 answered on 23 Aug 2013
1 answer
194 views
Uncaught Error: Syntax error, unrecognized expression: input:hidden[name='Sections\[0\']\.Settings\[0\]\.Value] jquery.min.js:4

The HTML it's failing on is as follows:

<input data-val="true" data-val-required="The Boolean field is required." id="Sections_0__Settings_0__Value" name="Sections[0].Settings[0].Value" type="checkbox" value="true" />
<input name="Sections[0].Settings[0].Value" type="hidden" value="false" /> 
<span class="field-validation-valid" data-valmsg-for="Sections[0].Settings[0].Value" data-valmsg-replace="true"></span>

Can this be fixed ASAP
Rosen
Telerik team
 answered on 23 Aug 2013
7 answers
310 views
Hello,
it is possible to use the edit and delete buttons,but to put my own action,a javascript function,when i click on them?
i want to use them,because they already have their style(image and color) ,OR to create custom buttons just like the edit/delete buttons,with my own handler when i click on them.

Regards,
Daniel
Max
Top achievements
Rank 1
 answered on 23 Aug 2013
1 answer
438 views
Hello,
I would like to know if there are some examples on how to create a Master Detail Page with Kendo UI. This is what I would like to have:

1) A Grid acting as the master, displaying master rows with buttons for adding, updating and deleting records.

2) Under the Grid I would like to have a PartialView? showing a form details where the user can view the detail data of the selected grid row
, enter data for a new entry, update the details of the selected grid row.

Best Regards
Petur Subev
Telerik team
 answered on 22 Aug 2013
1 answer
454 views
I have been using inline edit with the Grid control in several projects for a while now and everything has worked great.  However, on a new page I have a grid that uses inline editing/creation, however when create is called via Ajax, all of the rows are passed into the controller action and my code is duplicating all the records.  I have compared this page with the pages that work correctly and I cannot seem to find the issue.  I must be missing something.  I think I just need another set of eyes.  Below is the code in the page/controller that is NOT working.

@model SS.Web.Models.SystemCustomerConcernViewModel
@{
    ViewBag.Title = "SystemCustomerConcern";
}
<section class="contentTitle">
    Customer Concern List
</section>
@(Html.Kendo().Grid<SS.Web.Models.SystemCustomerConcernViewModel>()
    .Name("SystemCustomerConcernGrid")
    .Columns(columns =>
    {
        columns.Command(command => command.Destroy()).Width(90).HtmlAttributes(new { style = "vertical-align: top;" });
        columns.Bound(p => p.SystemCategoryType).ClientTemplate("#=SystemCategoryType.description#").Width(160).HtmlAttributes(new { style = "vertical-align: top;" });
        columns.Bound(i => i.customerConcern).HtmlAttributes(new { style = "vertical-align: top;" });
        columns.Bound(i => i.billedHours).Width(100).HtmlAttributes(new { style = "vertical-align: top;" });
        columns.Bound(i => i.techPayHours).Width(115).HtmlAttributes(new { style = "vertical-align: top;" });
        columns.Bound(i => i.servicePerformed);
    })
    .ToolBar(toolBar =>
    {
        toolBar.Create();
        toolBar.Save();
    })
    .Editable(editable => editable.Mode(GridEditMode.InCell))
    .HtmlAttributes(new { style = "height: 675px" })
    .Pageable()
    .Sortable()
    .Scrollable()
    .Navigatable() //set so user can tab between cells in edit mode
    .DataSource(dataSource => dataSource
                                .Ajax()
                                .Events(events => events.Error("error_handler"))
                                .PageSize(100)
                                .Batch(true)
                                .ServerOperation(false)
                                .Model(model =>
                                {
                                    model.Id(i => i.systemCustomerConcernID);
                                    model.Field(p => p.SystemCategoryType).DefaultValue(
                                        ViewData["defaultSystemCategoryType"] as SS.Web.Models.SystemCategoryTypeViewModel); //this is used when you add a new item
                                })
                                        .Read(read => read.Action("List", "SystemCustomerConcern"))
                                        .Create(create => create.Action("Create", "SystemCustomerConcern"))
                                        .Update(update => update.Action("Update", "SystemCustomerConcern"))
                                        .Destroy(destroy => destroy.Action("Delete", "SystemCustomerConcern"))
                                ))
<script type="text/javascript">
    function error_handler(e) {
        if (e.errors) {
            var message = "Errors:\n";
            $.each(e.errors, function (key, value) {
                if ('errors' in value) {
                    $.each(value.errors, function () {
                        message += this + "\n";
                    });
                }
            });
            alert(message);
        }
    }
</script>



[AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Create([DataSourceRequest] DataSourceRequest request,
            [Bind(Prefix = "models")]IEnumerable<SystemCustomerConcernViewModel> systemCustomerConcerns)
        {
            var results = new List<SystemCustomerConcernViewModel>();

            if (systemCustomerConcerns != null && ModelState.IsValid)
            {
                foreach (var systemCustomerConcernViewModel in systemCustomerConcerns)
                {
                    SystemCustomerConcern systemCustomerConcern = new SystemCustomerConcern
                    {
                        customerConcern = systemCustomerConcernViewModel.customerConcern,
                        billedHours = systemCustomerConcernViewModel.billedHours,
                        techPayHours = systemCustomerConcernViewModel.techPayHours,
                        servicePerformed = systemCustomerConcernViewModel.servicePerformed,
                        isActive = systemCustomerConcernViewModel.isActive,
                        systemCategoryTypeID = systemCustomerConcernViewModel.SystemCategoryType.systemCategoryTypeID
                    };

                    systemCustomerConcernViewModel.systemCustomerConcernID = this.systemCustomerConcernService.Create(systemCustomerConcern);
                    results.Add(systemCustomerConcernViewModel);
                }
            }

            return Json(results.ToDataSourceResult(request, ModelState));
        }

Daniel
Telerik team
 answered on 22 Aug 2013
2 answers
603 views
Hello,

I know there is an InnertHtml button and I need to build the same functionality. working on other elements. 
How can I add text to the Kendo UI MVC Editor at the cursor position ?
Shaun
Top achievements
Rank 1
 answered on 22 Aug 2013
1 answer
732 views
Hi to everyone.
I have an MVC view with a Kendo DatePicker
@(Html.Kendo().DatePicker()
                        .Name("myDataPicker")       
                        .Value(DateTime.Now.Date)
                        .Format("dd/MM/yyyy")
                        .HtmlAttributes(new  {style = "width: 150px;" })
                    )


I need to change the date of my element from javascript, and I'm doing it in this way
 $("#myDataPicker").kendoDatePicker({
                value: new Date(),        
                format: "dd/MM/yyyy", ( I have to do this because it doesn't remember the given format in the helper )
            });

It works but this function changes some style in the element, in particular in the first span
k-input is added causing a padding issue and style has now a width:100%, not 150px as I set in the helper and I have when the page is just opened
so before
<span class="k-widget k-datepicker k-header" style="width: 150px;">
after
<span class="k-widget k-datepicker k-header k-input" style="width: 100%;">

I have to use an ugly workaround changing the class and style from jquery but I was wondering if there is a better solution

any help is appreciated
thank's
Mauro
Georgi Krustev
Telerik team
 answered on 22 Aug 2013
7 answers
225 views
I was originally using the Scheduler in a project with simply one html and one css file. Now I am currently using the trial version of Kendo UI Complete for ASP.NET MVC and have the Scheduler set up as an MVC 4 project. The javascript from my original code still creates the calendar; however I am currently commenting out the old code and instead attempting to borrow from the code provided on the demo for ASP.NET MVC, index.cshtml. Here's my adaption of the code:

@(Html.Kendo().Scheduler<iDashboard.Models.TaskViewModel>()
    .Name("scheduler")
    .Date(new DateTime(2013, 6, 13))
    .StartTime(new DateTime(2013, 6, 13, 7, 00, 00))
    .Height(400)
    .Views(views =>
    {
        views.DayView();
        views.WeekView(weekView => weekView.Selected(true));
        views.MonthView();
        views.AgendaView();
    })
    .Timezone("Etc/UTC")
    .Resources(resource =>
    {
        resource.Add(m => m.OwnerID)
            .Title("Owner")
            .DataTextField("Text")
            .DataValueField("Value")
            .DataColorField("Color")
            .BindTo(new[] {
                new { Text = "Office", Value = 1, Color = "#f8a398" } ,
                new { Text = "Home", Value = 2, Color = "#51a0ed" } ,
                new { Text = "Shared", Value = 3, Color = "#56ca85" }
            });
    })
    .DataSource(d => d
        .Model(m => {
            m.Id(f => f.TaskId);
            m.Field(f => f.OwnerID).DefaultValue(1);
        })
        .Read("Task_Read", "Home")
        .Create("Task_Create", "Home")
        .Destroy("Task_Destroy", "Home")
        .Update("Task_Update", "Home")
        .Filter(filters =>
        {
            filters.Add(model => model.OwnerID).IsEqualTo(1).Or().IsEqualTo(2);
        })
    )
)

For some reason I am only getting a gray line. I'm not sure why the .Views method is not working. As far as I know, I referenced all the necessary files in the head tag of _Layout in the html. I could be wrong but it seems to me that everything is fine with the model and controller, but for some reason the view is not displaying the scheduler. I'd appreciate if someone could point me in the right direction. Thank you!

Note: I based the model and controller off of the following tutorial --> http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/scheduler/ajax-editing


Rosen
Telerik team
 answered on 22 Aug 2013
1 answer
1.1K+ views
Hello,
I'm trying to develop a search form that will load datas from a stored procedure into a Kendo UI Grid item....

I've some problem passing back the Model to the Action Method in the controller...

Here's my view code

@model  DemoRicerca_Interno.Models.RicercaClienteObject
 
 
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
 
 
 
 
<div>
    <div id="ricerca"></div>
 
    <div>Query : @Html.EditorFor(x => x.Query)</div>
    <div>Match Exact : @Html.EditorFor(x => x.MatchExact)</div>
    <div>AncheEstinti : @Html.EditorFor(x => x.AncheEstinti)</div>
    <button id="showGrid">Carica</button><br />
 
    <script type="text/javascript">
        $("#showGrid").click(function () {
            $("#grid").data("kendoGrid").dataSource.read();
        });
 
        
    </script>
 
 
    <div id="content">
        @(Html.Kendo()
            .Grid<DemoRicerca_Interno.Models.Rapporto>()
            .AutoBind(false)
            .Name("grid")
            .Columns(columns =>
                {
                    columns.Bound(x => x.IDInterno).Visible(false);
                    columns.Bound(x => x.IDRapporto);
                    columns.Bound(x => x.Descr);
                    columns.Bound(x => x.Filiale);
                    columns.Bound(x => x.RM);
                    columns.Bound(x => x.NDG);
                })
                .DataSource(ds => ds
                .Ajax()
                .Read(read =>
                    {
                        read.Action("GetClienti", "Ricerca");
                            //new DemoRicerca_Interno.Models.RicercaClienteObject { Query = Model.Query, MatchExact = Model.MatchExact, AncheEstinti = Model.AncheEstinti });
                    }
                    )
 
              )
 
            )
    </div>
 
 
</div>
The RicercaController

public
class RicercaController : Controller
   {
       public ActionResult Index()
       {
           ViewData.Model = new RicercaClienteObject();
 
           return View();
       }
 
       public ActionResult GetClienti([DataSourceRequest] DataSourceRequest request, RicercaClienteObject ricerca)
       {
           xxxEntities model = new xxxEntities();
 
           var res = model_SP_GET_INTESTATARIO(xxx, ricerca.Query, ricerca.MatchExact, xxx, DateTime.Now.AddDays(-1), 0, ricerca.AncheEstinti, null, null);
 
           List<Rapporto> lst = new List<Rapporto>();
 
           foreach (var item in res)
           {
               var rapporto = new Rapporto();
 
               rapporto.Descr = item.INTESTAZIONE.Trim();
               rapporto.Filiale = item.FILIALE.Trim();
               rapporto.IDRapporto = item.CODICE_RAPPORTO.Trim();
               rapporto.NDG = item.NDG.Trim();
               rapporto.RM = item.RM.Trim();
               rapporto.IDInterno = item.ID_RAPPORTO;
 
               lst.Add(rapporto);
           }
 
           var result = lst.ToDataSourceResult(request);
           return Json(result);
 
       }
 
   }
And the models

public class RicercaClienteObject
  {
     
      [DataType( System.ComponentModel.DataAnnotations.DataType.Text)]
      public string Query { get; set; }
      public int AncheEstinti { get; set; }
       
      public int MatchExact { get; set; }
  }
 
 public class Rapporto
  {
      public string IDRapporto { get; set; }
       
      public string Descr { get; set; }
       
      public int? IDInterno { get; set; }
       
      public string Filiale { get; set; }
       
      public string RM { get; set; }
       
      public string StatoRapporto { get; set; }
       
      public string NDG { get; set; }
       
      public string Servizio { get; set; }
       
      public int? IDCliente { get; set; }
  }
How do I pass back the Model without using a js function and create a javascript object?

Thanks

Daniel
Telerik team
 answered on 21 Aug 2013
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?