Telerik Forums
UI for ASP.NET MVC Forum
5 answers
1.3K+ views
I have a Kendo grid with inline editing. It works great. An issue I have right now is that after an inline update of a record, if certain conditions of the update exist I need to redirect to another Page i.e. RedirectToAction. So the code looks like:

public ActionResult EditingInline_Update([DataSourceRequest] DataSourceRequest request, OrderViewModel order)
{           
   if (order != null && ModelState.IsValid)
   {
       order = UpdateOrder(order);
       repository.UpdateOrder(order);
  
}
   if (order.orderStatus == "HD")
         return RedirectToAction("Info");           
    return Json(ModelState.ToDataSourceResult());
 }

This code works as designed but will not display the page. This of course is due to the AJAX call which is returning to the datasource.

Several things happen on the line order = UpdateOrder(order);  This method is in the Controller and sets several fields in the record that was updated including the orderStatus. The repository.UpdateOrder(order) happens in the SessionOrderRepository class.

Since the fields in the UpdateOrder method of the Controller are not set by the user, the information is not updated in the grid either (grid updates immediately). And if for some reason the orderStatus is placed in the "HD" (hold) state we want to redirect the user to a page that displays the reason(s) that the order is on hold. Clicking Ok on that page would redirect them to the grid and all of the fields would be updated since it has to reload.

Technically this is probably not a Kendo issue but if anyone has a work around on this your help would be greatly appreciated.

Regards,

Paul

Mikul
Top achievements
Rank 1
 answered on 03 Nov 2012
0 answers
197 views
Hello!
First of all I'd like to congratulate you on your work.
One small suggestion is that it would be better if you expanded your documentation and examples, especially for mvc.

My question is stated in the title. I have a vs project and I use mvc. I also have some javascript functions that I'd like to fire whenever someone clicks on a button. I can make this happen but I don't know how to pass arguments.

The way I've implemented is by using htmlattributes on custom command and passing new {onclick = "MyFunction()"}.
This works but I need parameters as well. And I need a parameter from the same row's element.

Can you please help me?
Thank you very much in advance!
Romanos
Top achievements
Rank 1
 asked on 02 Nov 2012
20 answers
1.2K+ views
Hi,

Using a simple ClientTemplate for a details url in a grid which worked in Telerik.MVC product the same cannot be said for Kendo UI.

@(Html.Kendo().Grid<VehicleGroupGridRow>()
    .Name("VehicleGroupGrid")
    .Columns(column =>
    {
        column.Bound(p => p.Title).ClientTemplate("<a href='/VehicleGroup/Details/#= Id #'>#= Title #</a>");
        column.Command(command => { command.Edit(); command.Destroy(); });
    })
    .ToolBar(commands => commands.Create())
    .Editable(editable => editable.Mode(Kendo.Mvc.UI.GridEditMode.InLine))
    .Sortable()
    .DataSource(dataSource => dataSource
            .Ajax()
            .Events(events => events.Error("error_handler"))
            .Model(model => model.Id(p => p.Id))
            .Create(create => create.Action("CreateVehicleGroup", "VehicleGroup"))
            .Read(read => read.Action("GetVehicleGroups", "VehicleGroup"))
            .Update(update => update.Action("UpdateVehicleGroup", "VehicleGroup"))
            .Destroy(destroy => destroy.Action("DestroyVehicleGroup", "VehicleGroup"))
    )
     
)

When I attempt to add a new item I get a Microsoft JScript runtime error 'Id' is undefined.

If I don't use a ClientTemplate then the grid works fine.

Thanks in advance
Philip
Top achievements
Rank 1
 answered on 02 Nov 2012
2 answers
588 views
If you add the class k-textbox to a TextArea, in firefox the text wraps as it should. However, in chrome it thinks its a TextBox and does not wrap.
nathan
Top achievements
Rank 1
 answered on 02 Nov 2012
0 answers
128 views
So I've spent the better part of my afternoon trying to find documentation or examples on how .Toolbar should work with a Kendo MVC grid and I've come up empty.  I've found its easy enough for a predefined command type (command.Create for example) but I'm trying to find documentation on how commands.Custom is supposed to work.  Does anyone have any documentation?  There was no mention of the Toolbar method at all in the API documentation.
Dan
Top achievements
Rank 1
 asked on 01 Nov 2012
2 answers
269 views
Hi,

I would like to know if someone had the same problem than me and if possible give me some help.
I was trying the grid component with a ForeingKey column and it works ok when I use the Visual Studio Compilation, but when I published the application it did not work very well. The column comboBox do not works.
I put all the .dll files in the project and had the same problem.
Have any idea?

I'm using visual studio 2010 with SP1
I published the application in IIS 7

Images to show my problem

IIS Publish [erro]
http://postimage.org/image/xjb3mlvfl/

Visual Studio Compilation [ok]
http://postimage.org/image/hz3pw2lb5/


Felipe
Top achievements
Rank 1
 answered on 01 Nov 2012
6 answers
376 views
I have a grid with a checkbox in each row to select the row
How can I highlight the checked rows?

I used the following codes in the Change event
var grid = $("#grid").data("kendoGrid");
grid.select($("tr[data-uid]").has("input[name=checkboxName]:checked"));

However, when I unselect a row, the unselected row is still highlight
Can I disable user to select a row, but only select row by javascript?
Richard
Top achievements
Rank 1
 answered on 01 Nov 2012
0 answers
118 views
Can you point me to documentation for using the Entity Data Framework to source data with Kendo MVC widgets (preferably GRID)?
Thank you
Aron
Top achievements
Rank 1
 asked on 01 Nov 2012
1 answer
1.4K+ views
I am using custom commands and trying to get the selected dataitem. I am getting an error inside 
the javascript call on this.dataitem
By debugging in chrome i can see that the this.data is not populated on binding directly to a model. 
Where as in the telerik examples it is populated.
This is my code:
@using Kendo.Mvc.UI
  @{
     var addressList = Model.DataList as List<Intelli.Data.Parties.EFDAL.Entity.GeoAddress>;
   }
 
<script type="text/javascript">
  function viewgeoaddress(e) {
         //prevent the request which will be made by default
         e.preventDefault();
 
        //error occurs here!!
         var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
          
 
         }
     };
</script>
 
 
 @(Html.Kendo().Grid(addressList)
    .Name("GridPartyGeoAddresses")
    .Columns(columns =>
            {
                columns.Bound(p => p.ID).Title("ID").Hidden(true);
                columns.Bound(p => p.Address).Title("Address").Width(160);
                columns.Bound(p => p.Region).Title("Region").Width(80);
 
                columns.Bound(p => p.Zipcode).Title("Zipcode").Width(80);
                columns.Command(commands => commands
                                                .Custom("btnviewgeoaddress")
                                                .Text("View")
                                                .Click("viewgeoaddress")
                                                .HtmlAttributes(new { style = "text-align: center" }));
                columns.Command(commands => commands
                                                .Custom("btndeletegeoaddress")
                                                .Text("Remove")
                                                .Click("deletegeoaddress")
                                                .HtmlAttributes(new { style = "text-align: center" }));               
                 
 
            })
 
    .Scrollable(scr => scr.Enabled(true).Height(300))
    .Sortable(builder => builder.Enabled(true))
    .Resizable(resizing => resizing.Columns(true))
    //.Selectable()
    //                .DataSource(dataSource => dataSource
    //                                              .Ajax()
    //                                               .ServerOperation(false)
 
    //                    )
     
    )
 
 
Vladimir Iliev
Telerik team
 answered on 01 Nov 2012
1 answer
849 views
Hi,

I'm trying to have a simple event that will execute on grid's databound but the grid doesn't seem to locate it.

The error is my script method is not define based on firebug

Here's my code..

@(Html.Kendo().Grid<Model>()    
    .Name("Grid")
    .Columns(columns =>
                 {
                     columns.Bound(p => p.Name);
                     columns.Bound(p => p.Allow);
                     columns.Bound(p => p.Category);
                 })
    .DataSource(dataSource => dataSource
        .Ajax()
        .Group(group => group.Add(p => p.Category))
        .Read(read => read.Action("Data""Method"))     )     .Selectable(selectable => selectable.Mode(GridSelectionMode.Single))     .Events(events => events.DataBound("GridOnDataBound"))          )

<script type="text/javascript">
    function GridOnDataBound() {
        alert("I'm in");
    }
</script>


Jayesh Goyani
Top achievements
Rank 2
 answered on 01 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
Dialog
MultiColumnComboBox
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
Security
ColorPicker
DateRangePicker
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
SmartPasteButton
PromptBox
SegmentedControl
LLM Kit
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?