Telerik Forums
UI for ASP.NET MVC Forum
2 answers
71 views

Hey,

I would like to pass an ID to my controller when the update event is fired on my grid.  Has anyone done this before?

.Update(update => update.Action("data_update", "Home"))

Viktor Tachev
Telerik team
 answered on 08 Apr 2016
2 answers
256 views
Hi, as i'm new to these forums, i hope you will not be to hard on me if the solutions is obvious :-)


Let's say i have setup this grid with Products including a foreign key dropdownlist to ProductTypes. Some of these ProductTypes are no longer in use (marked boolean property 'IsValid')
The requirement is that all Products with ProductType are shown independent of the 'IsValid property'. So far so good.
Now the point where i need some help: when a record is added, i would like the ProductType dropdown to only list ProductTypes that are marked as valid. And to make it even more difficult: When a row is in edit mode, i would like the dropdown to only show the valid ProductTypes AND the current ProductType even if that is invalid.
public class ProductController : Controller
    {
        private DBEntities db = new DBEntities ();
 
        public ActionResult Index()
        {
            ViewData["ProductTypes"] = db.ProductTypes.Select(b => new { Id = b.idProductType, Name = b.ShortName });
            return View();
        }

@(Html.Kendo().Grid<Data.EF.Models.Product>()
      .Name("grid")
      .Columns(columns =>
      {
          columns.Bound(c => c.Code);
           columns.Bound(c => c.Color);
          columns.ForeignKey(c => c.idProductType,
(System.Collections.IEnumerable)ViewData["ProductType"], "Id", "Name").Title("Type");
          columns.Command(command => { command.Edit(); command.Destroy(); }).Width(180);
      })
      .ToolBar(toolbar => {
          toolbar.Create();
          toolbar.Excel();
      })
      .Editable(editable => editable.Mode(GridEditMode.InLine))
      .Sortable(sortable => {
          sortable.SortMode(GridSortMode.MultipleColumn);
      })
      .Filterable()
      .Scrollable(scrollable => scrollable.Enabled(false))
      .DataSource(dataSource => dataSource
          .Ajax()
          .Model(model => model.Id(p => p.idProduct))
          .Read(read => read.Action("KProduct_Read", "Product"))
          .Create(create => create.Action("Product_Create", "Product"))
          .Update(update => update.Action("Product_Update", "Product"))
          .Destroy(destroy => destroy.Action("Product_Destroy", "Product"))
      )
)
Nikolay Rusev
Telerik team
 answered on 08 Apr 2016
14 answers
1.0K+ views

I have these model classes:

public class Part
{
    public Guid Id { get; set; }
    string Name { get; set; }
    public Part()
    {
    }
}
 
public class DetailItem
{
    public Guid Id { get; set; }
    public Part Part { get; set; }
 
    public DetailItem()
    {
    }
}

In my View, the model is the DetailItem. I am trying to use a ComboBox to select the Part for the DetailItem:

 

@(Html.Kendo().ComboBoxFor(model => model.Part)
    .DataValueField("Id")
    .DataTextField("Name")
    .Filter(FilterType.Contains)
    .DataSource(source =>
    {
        source.Read(read =>
        {
            read.Action("GetParts", "RefData");
        })
 
        .ServerFiltering(true);
    }
    )
)

When I save the page, the DetailItem.Part never gets set from the ComboBox. How do I make this work?
Bill Wingate
Top achievements
Rank 1
 answered on 07 Apr 2016
4 answers
296 views

I have a grid with a large data set and I have a button that clears filters and sorting but each one causes a refresh of the data:

    $(function () {
        $("#reset").click(function (e) {
            e.preventDefault();
            var datasource = $("#grid").data("kendoGrid").dataSource;
            //Clear filters:
            datasource.filter([]);

          //Clear sorting:
            datasource.sort({});
        });
    });

Is there a way to combine this to only refresh the data once.

Thanks,

Erik

Erik
Top achievements
Rank 2
 answered on 07 Apr 2016
1 answer
353 views

I've got a ComboBox which uses Grouping and I'm having trouble setting the selected item:

            @(Html.Kendo().ComboBox()
                  .Name("GroupedList")
                  .Placeholder("Select...")
                  .DataValueField("Value")
                  .DataTextField("Text")
                  .MinLength(3)
                  .Filter("contains")
                  .HtmlAttributes(new { style = "width:100%;" })
                  .Height(400)
                  .DataSource(source => source
                      .Custom()
                      .Group(g => g.Add("GroupKey", typeof(string)))
                      .Transport(transport => transport
                          .Read(read =>
                          {
                              read.Action("GetMyItems", "MyController");
                          })
                      )
                      .ServerFiltering(false)
                  )
            )

My controler is returning JSON in the following format with one of the items optionally having "Selected":true

[{"GroupKey":"Address","GroupName":"Address","Selected":false,"Text":"Correspondence Post Code","Value":"821"},...etc..]

Ivan Danchev
Telerik team
 answered on 07 Apr 2016
1 answer
106 views

Hi,

I'm using version 2016.1.226 and the new "Is null" and "Is not null" filters are not working correctly on DateTime columns (as well as DateTime? columns). 

When I select "Is null" on a DateTime column, it seems to filter the column but the Cancel button (the X button next to filter) does not appear. Then I select "Is not null" and then "Is null" again, the Cancel button appears but it does not do anything. So the only way to get rid of the filtering is to refresh the page.

These filter operators seem to work on String columns though.

Thanks.

Rosen
Telerik team
 answered on 07 Apr 2016
4 answers
341 views

Hi, 

I'm trying to use a DropDownList event to trigger a complex page update (updating a bunch of divs, DataSource reads, etc), and cannot find an event that happens at the right *time* to get the behavior I want.  I want to call a javascript function AFTER the user has selected an item from the dropdownlist, AND the DropDownList has refreshed with the user's selection.  All the events listed here (http://docs.telerik.com/kendo-ui/api/javascript/ui/dropdownlist#events) fire BEFORE the widget completes updating.  The reason I want to do this is to show a "Loading...." message, while the complex page update takes place (it is very complex and takes a couple of seconds), then hide "Loading" and show the new stuff.

Are there any other events I could use to trigger my activity?  Executing my update function via an event handler for any of the documented events resulting in the following sequence:

-drop down list expands

-user picks an item

-the page sitting for a couple of seconds while my update happens, with the list still expanded

-drop down list retracts and the page finishes nicely ....

 

I need an event that fires AFTER the DropDownList finishes updating.

 

bootstrap has such an event, as shown here: 

http://www.w3schools.com/bootstrap/tryit.asp?filename=trybs_ref_js_dropdown_events&stacked=h

the hidden.bs.dropdown event is what I want.

Is there a generic Kendo equivalent, or workaround?  The control doesn't have to be a drop down list, its just that was simplest - there are very few items in it.  I would prefer to stick with a simple Kendo control, but if there isn't an appropriate event I'll use something else or a workaround -

Thanks!

David
Top achievements
Rank 1
 answered on 06 Apr 2016
3 answers
114 views

Hi,

I am trying to get the MVC date picker to parse and format dates the same as the ASP.Net date picker does, eg. user enters 1/1/11 and the picker formats it into 1/1/2011.

How do I get the MVC date picker to do this?

Thanks.

Viktor Tachev
Telerik team
 answered on 06 Apr 2016
5 answers
390 views
Hi guys,

I'm working with the asp.net MVC panelbar. I have succeeded in creating the databound panelbaritems but I don't know how to create the child items.
I have one class
public class Item
{
    public string Header{get;set;}
    public string Description{get;set;}
    public DateTime PostedDateTime{get;set;}
}

The panelbaritems contain the PostedDateTime and the Header, and now I want the child to contain the Description.

Can you show me an example of how to do this?

thanks
Hristo Valyavicharski
Telerik team
 answered on 06 Apr 2016
3 answers
309 views

I have written my issue. Please help

llink

Rosen
Telerik team
 answered on 06 Apr 2016
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
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
DateTimePicker
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
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?