Telerik Forums
UI for ASP.NET MVC Forum
3 answers
505 views
I am not sure what I am missing here, I have a grid that I just want to update, not create or destroy. I thought I had done this correctly, but the save button does not fire my update method on the user controller.  

  <div id="CampaignGrid">
        @(Html.Kendo().Grid<SubCampaign>()
              .Name("grid")
              
              .Columns(columns =>
              {
                  columns.Bound(c => c.CampaignName);
                  columns.Bound(c => c.Status).ClientTemplate("<input type='checkbox' value='#= Status #' " +
                                                                "# if (Status) { #" +
                                                                    "checked='checked'" +
                                                                "# } #" +
                                                            "/>");
              })
              .ToolBar(toolbar => toolbar.Save())
                    .Editable(editable => editable.Mode(GridEditMode.InCell))
                    .DataSource(dataSource => 
                        dataSource.Ajax()
                        .Batch(true)
                        .Model(model =>
                        {
                            model.Id(campaign => campaign.Id);
                            model.Field(campaign => campaign.CampaignName).Editable(false);
                            model.Field(campaign => campaign.Status);
                        })
                        .Read(read => read.Action("SwitchCampaignRead", "User"))
                        .Update(update => update.Action("SwitchCampaigns", "User")))
                        .HtmlAttributes(new { style = "height: 380px;" })
                        .Scrollable()
                        .Sortable()
                        .Pageable(pageable => pageable
                            .Refresh(true)
                            .PageSizes(true)
                            .ButtonCount(5))

              )
    </div>
Kelso
Top achievements
Rank 1
 answered on 22 Jul 2014
4 answers
390 views
I am using the latest kendoui internal build (2013.2.808.340) in order fix some other issues I am having with the current release build.

I have found that when using the MVC wrappers and setting the the class attribute via .HTMLAtrributes on commands in the grid kendo no longer renders the button with the correct class.

Example: 
c.Command(command =>
    {
command.Edit().HtmlAttributes(new { @class = "btn" }).UpdateText("Save");
command.Destroy().HtmlAttributes(new { @class = "btn" });
                             });

Resulting rendered HTML no longer has the class "btn":
<a class="k-button k-button-icontext k-grid-edit" href="#">


Dimiter Madjarov
Telerik team
 answered on 22 Jul 2014
5 answers
784 views
I'm defining a window in Asp.net mvc with following:
@(Html.Kendo().Window()
    .Name("staffsec")
    .Title("Edit")
    .Actions(a => a.Minimize().Maximize().Close())
    .Content("")
    .Modal(true)
    .Visible(false)
    .Width(440)
    .Height(500)
    .Scrollable(true)
    .Position(settings =>
    settings.Top(50).Left(300))
)

And using follwing Java Script to load the window

 
var staffId = '@Html.Raw(Json.Encode(Model.StaffModel.StaffId))';
 var windowk = $("#staffsec").data("kendoWindow");
windowk.refresh({< url: "@Url.Content("/StaffSecurity/Index/")", data: { id: staffId  });<br>windowk.title("Staff Security"); windowk.open();
return event.preventDefault();

Issue is, window is displayed only first time i click. Next time i click i get error on console that 'windowk' is undefined. I've used the same technique on different form, there is no issue. 
Words of wisdom will be appreciated..

Abdul Rehman







Dimo
Telerik team
 answered on 22 Jul 2014
1 answer
225 views

Hi

I need to create a search modal window that allows me to
type a search criteria, display the results on a grid, allow the user 
select a row from that grid and then pass the Id of the select row back
to parent window.

I'm using MVC5 and  Kendo UI.

What's the best way to achieve this?
Dimo
Telerik team
 answered on 22 Jul 2014
4 answers
892 views
@(Html.Kendo().Grid<positions.Models.vOpenPositionsDistinct>()
.Name("gridMain")
.DataSource(dataSource => dataSource // Configure the grid data source
.Ajax() // Specify that ajax binding is used
.Read(read => read.Action("Positions_Read", "Home")) // Set the action method which will return the data in JSON format
)
.Columns(columns =>
{
columns.Bound(s => s.SourceURL).ClientTemplate("<a href='" + Url.Content("#= SourceURL #") + "' target='_blank'>#: SourceURL #</a>").HeaderTemplate("Source URL").Width(120);

})

I have external url links stored in my database and I want to bind them in a grid column as <a href> tag. If I use the code above all rows will have the 1st row SourceURL Value .

What am I doing wrong? It seems as if it creates a generic template for all rows and the template has same url.

Jim
Top achievements
Rank 1
 answered on 22 Jul 2014
2 answers
134 views
Hi,

We have an issue with the current Kendo UI Editor using asp.net wrappers.

User's are reporting formatting errors when pasting from Word. Either text disappears or is un-editable after pasting.

I have upgraded to the latest Kendo UI framework (2014.2.716.545) this morning in the hope of using the new cleanFormatting tool in the Editor widget. I was hoping this would help solve the issue and prevent me from having to switch to another third party Editor.

However it doesn't appear as an option in the asp.net mvc wrapper (Kendo.Mvc.UI.Fluent.EditorToolFactory). Is this by design or can it be found elsewhere?

Thanks,

Rik  
Ricky Shadbolt
Top achievements
Rank 1
 answered on 22 Jul 2014
6 answers
800 views
Using the MVC3 wrappers for Kendo UI, my grids are wired up to Controllers for their various CRUD operations.  

In one of my models, I have a series of boolean values (that in turn handle values for checkboxes) where at least one has to be checked before being considered "valid".  As I have not found a good way to handle that kind of validation directly in the model, I am manually checking those 3 booleans in the ActionResult and where all are false, I return an error on the ModelState.  

What I would like to be able to do is when the grid receives the error in its respective event, to keep the row that was being edited in edit mode.  My attempts to put the row in edit mode manually have not worked, as it appears a sync is firing, which triggers DataBound, which tromps all over my row that I just put into edit mode.  

Is there a way to:
1.  Instruct a grid to keep edit mode open (with the original values) when an Error event is triggered from a DataSource save?
or
2. Define a custom client-side validation step to perform the check against those booleans before the DataSource Save?
Samer
Top achievements
Rank 1
 answered on 21 Jul 2014
3 answers
143 views
Trying to implement the popup editor as per http://demos.telerik.com/aspnet-mvc/grid/editing-popup

I already have grid displaying data (index.cshtml) but now not sure how to incorporate the .cshtml and .cs "files" displayed on this page.

First question is, why is there only one .cshtml page but multiple controllers on the .cs page?  Is there supposed to be just one .cshtml page and I should place everything in it (in this case index.cshtml)?

Thanks,
Dimiter Madjarov
Telerik team
 answered on 21 Jul 2014
7 answers
259 views
I added ClientTemplate() to my column so that I can display the value as "Yes" and "No" rather than the default "True" and "False".
columns.Bound(p => p.IsActive).ClientTemplate("#= IsActive ? 'Yes': 'No'
#").Title("Is Active").Width(100);<BR>

However, the grid is still displaying True and False.

What am I missing?

Thanks,
Dimiter Madjarov
Telerik team
 answered on 21 Jul 2014
1 answer
319 views
Hi,
I have this code in my page

@(Html.Kendo().Grid<LibroDinamico.Models.LibroViewModel>()
        .Name("gridLibros")
        .Columns(columns =>
        {
            columns.Bound(c => c.Titulo);
            columns.Command(command => { command.Edit(); command.Destroy(); });
        })
        .Scrollable()
        .ToolBar(toolbar => toolbar.Create())
        .Editable(editable =>
        {
            editable.Mode(GridEditMode.PopUp);
        })
        .ColumnMenu(p => p.Columns(false))
        .Filterable().Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
        .Sortable(sortable => sortable.AllowUnsort(false))
        .Pageable(pageable => pageable
        .Refresh(true)
        .PageSizes(true)
        .PageSizes(new[] { 5, 10, 25, 50 }))
        .DataSource(dataSource => dataSource
                .Ajax()
                .PageSize(10)
                .Model(model =>
                {
                    model.Id(p => p.Id);
                    model.Field(p => p.Id).Editable(false);
                })
                .Create(create => create.Action(MVC.Libro.ActionNames.Create, MVC.Libro.Name))
                .Read(read => read.Action(MVC.Libro.ActionNames.GetLibros, MVC.Libro.Name))
                .Update(update => update.Action(MVC.Libro.ActionNames.Edit, MVC.Libro.Name))
                .Destroy(destroy => destroy.Action(MVC.Libro.ActionNames.Delete, MVC.Libro.Name))
        )
      )  
With this ViewModel    

public class LibroViewModelwith 
    {
        public int Id { get; set; }
        public string Titulo { get; set; }
        public DateTime Creado { get; set; }
        public DateTime Modificado { get; set; }
    }

When I click in Add a new row the popup appears with all the properties of the view model, but I dont want to show all this properties, I want only to present the Titulo. How I can do this. 
Thanks



















Dimiter Madjarov
Telerik team
 answered on 21 Jul 2014
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
Wizard
Security
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
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?