Telerik Forums
UI for ASP.NET MVC Forum
1 answer
109 views
     Anyone know of a way I can search for a record and programmatically start inline editing a record that might be on another server side page of my grid? e.g. I have a grid that gets it's data from entity framework using linq. It has pagination enabled and gets each page from the server as requested. Is there a good way to search for a specific record and navigate to the page it's on and start inline editing it?
Preslav
Telerik team
 answered on 13 Mar 2018
3 answers
315 views

I have tried setting up a pivot grid following the demos at http://demos.telerik.com/aspnet-mvc/pivotgrid/local-flat-data-binding and http://demos.telerik.com/aspnet-mvc/pivotgrid/remote-flat-data-binding.

 

using this model

public class FundModel
{
    public string AssetClass { get; set; }
    public DateTime ReportDate { get; set; }
    public decimal? AssetsStart { get; set; }
}
 

 and this controller

 

public ActionResult TestView()
{
    return View(
       // GetAdvisors()
       GetFunds()
        );
}
 
 
private IEnumerable<FundModel> GetFunds()
{
    IEnumerable<FundModel> funds;
    using (var context = new EPFRUI_Entities())
    {
        funds = context.vwDailyFundFlowDetails.Take(300).Select(x => new FundModel
        {
            AssetClass = x.FundName,
            ReportDate = x.ReportDate,
            AssetsStart = x.AssetsStart
        }).ToList();
    }
    return funds;
}

 â€‹I am passing in my data to this pivot grid based on the demo code

 

    @(Html.Kendo().PivotConfigurator()
    .Name("configurator")
    .Height(570)
)
 
@(Html.Kendo().PivotGrid<FundModel>()
    .Name("pivotgrid")
    .Configurator("#configurator")
    .ColumnWidth(120)
    .Height(570)
    .BindTo(Model)
    .DataSource(dataSource => dataSource
        .Ajax()
        .Schema(schema => schema
            .Model(m => m.Field("CategoryName", typeof(string)).From("Category.CategoryName"))
            .Cube(cube => cube
                .Dimensions(dimensions => {
                    dimensions.Add(model => model.AssetsStart).Caption("Assets Start");
                    dimensions.Add("CategoryName").Caption("All Categories");
                    dimensions.Add(model => model.AssetClass).Caption("AssetClass");
                })
            .Measures(measures => measures.Add("AssetsStart").Field(model => model.AssetsStart).AggregateName("count"))
            ))
        .Columns(columns =>
        {
            columns.Add("CategoryName").Expand(true);
            columns.Add("AssetClass");
        })
        .Rows(rows => rows.Add("AssetClass").Expand(true))
        .Measures(measures => measures.Values("Sum"))
        .Events(e => e.Error("onError"))
    )
)

 

Which is getting me a single long line when I run the program and navigate to the view. I have included what shows up in the attached image.

 

I have also tried setting this up with remote binding and got the same view.

 

Am I missing an obvious step here? I debugged it and the model has data when the pivot grid is called, and no errors are coming back from the pivotgrid

 

 

 

Stefan
Telerik team
 answered on 13 Mar 2018
2 answers
272 views

Hi,

When using the Export to Excel is only works for the current page, is there anyway to export the whole table (dataset)?

Thanks,
Lee.

Lee
Top achievements
Rank 1
Veteran
 answered on 12 Mar 2018
2 answers
1.0K+ views

First off, I am very new to MVC, so apologies in advance.

I don't know what I'm missing, but I have an enum type:

 public enum ClientStatus
    {
        [Description("Unknown")]
        Unknown = 0,
        [Description("Normal")]
        Normal = 1,
        [Description("Legal Hold")]
        LegalHold = 200
    }

There is a database field which holds the integer value corresponding to the enum type.  For my grid, I have:

Html.Kendo().Grid<IST.DocstorClient.Database.cache_dsl_client>()
                    .Name("grid")
                    .Columns(columns =>
                    {
                        columns.Bound(o => o.dsl_client_id).Title("Client ID").EditorTemplateName("#dsl_client_id#");
                        columns.Bound(o => o.dsl_client_name).Title("Client Name");
                        columns.Bound(o => o.dsl_client_description).Title("Description");
                        columns.Bound(o => o.dsl_client_status).Title("Status").ClientTemplate("#=status_name#").EditorTemplateName("ClientStatus");
                        columns.Command(cmd => cmd.Destroy());
                    })
                    .ToolBar(toolbar =>
                    {
                        toolbar.Create();
                        toolbar.Save();
                    })
                    .Editable(editable => editable.Mode(GridEditMode.InCell))
                    .Pageable()
                    .Navigatable()
                    .PersistSelection()
                    .Sortable()
                    .DataSource(dataSource => dataSource
                        .Ajax()
                        .Batch(true)
                        .PageSize(10)
                        .Model(model =>
                        {
                            model.Id(p => p.dsl_client_id);
                            model.Field(p => p.dsl_client_id).Editable(false);
                        })
                        .Events(events => events.Error("dsr_error_handler"))
                        .Read("Editing_Read", "Client")
                        .Create("Editing_Create", "Client")
                        .Update("Editing_Update", "Client")
                        .Destroy("Editing_Destroy", "Client")

 

The item in question here is the column for dsl_client_status, which is defined as a byte? type in the Entity Framework definitions.

I also have a dropdown definition in Shared/EditorTemplates:

@(Html.Kendo().DropDownListFor(m => m)
   .Name("ClientStatus")
   .DataTextField("Text")
   .DataValueField("Value")
   .BindTo(EnumHelper.GetSelectList(typeof(IST.DocstorClient.Data.ClientStatus)))
   .OptionLabel("Select Status")
   .Value(((int)Model).ToString())
  )

 

I have been through a lot of iterations of different things, this is just the state things are in at the moment.

When I click on the cell to edit, I do get the dropdown list, but it is defaulted to the "Select Status", as if there is no value assigned.  I can then change the dropdown value, but the database value never gets updated.  If I click on it again, the value I changed to shows on the dropdown.

For example:

initial value is "Unknown".  
I click to edit, the dropdown list defaults to "Select Status".  
I change to "Normal" and click Save Changes. Text still shows as "Unknown".  
I click to edit again and the dropdown is defaulted to "Normal"

I've been scouring forums and blogs for days, trying all manner of suggestions, all to no avail.  I find it hard to believe that this is that difficult a task to achieve, so I gotta think I'm missing something simple here.

Dimitar
Telerik team
 answered on 12 Mar 2018
1 answer
169 views

We are trying to make to make our Grid date columns have the verbiage and filter options of "From" and "To". Our hope was that after updating them within the razor syntax we could still use the "AND OR" values. It appears to remove that option after we have to run the ".Operators(operators => operators.ForDate(d => d.Clear()".

 

Is there something we are doing wrong? When seem to need to run the ".Clear()" to remove other filter options but now we only have one value we can enter. Either being "To" or "From" but not being able to do "To: (n)" [AND | OR] From:".  Is this not possible if we are customizing the filters or is there a different route we can take to acomplish this?

 

-Thanks-

Code Example:

").Filterable(filterable => filterable.Extra(false).Operators(operators => operators.ForDate(d => d.Clear().IsLessThanOrEqualTo("To").IsGreaterThanOrEqualTo("From")))

 

Stefan
Telerik team
 answered on 12 Mar 2018
1 answer
153 views

Hi,

because my dropdown has over 1.000 possible values I've implemented ServersSide filtering

according to this example.

https://demos.telerik.com/aspnet-mvc/dropdownlist/serverfiltering

the only issue is that with a 1000 records servers side filtering still is slow when expanding the dropdownlist. because it the text is empty, all data is retrieved.

To avoid this issue I only select top 100 ".Take(100)" and the performance is way better.

the only issue is, when I open the dropdown for the 2nd time the selected item gets reset to the default one, if the selected item is not in the first 100 records.
In my oppinion, the current selected item should stay.

so My question, is there a way to make the current value stay,
or can I send the current selected value as a parameter?
for the edit Form, I already use the current value, so at least that one is always in the selection

read.Action("FilteredDDL", "some Controller", new { selectedValue = @Model.selectedvalue });

but this only helps if the value is already in the model.

 

Does someone know a good solution?

sjarl
Top achievements
Rank 1
 answered on 09 Mar 2018
2 answers
351 views
     My company just purchased the licenses for Telerik UI for ASP.NET MVC and I am trying to convert and our current project into a Telerik project, but I dont see the option to convert.  I only see the create new Telerik project option.  I have looked all over the website and the documentation site, but I dont see anything regarding this issue.  Am I missing something or is the option not there to convert an MVC 4 web app?
Justin
Top achievements
Rank 1
 answered on 09 Mar 2018
1 answer
582 views

Hi, i'm working with Telerik MVC controls (not Kendo controls) as this is an old application and it's been very difficult trying to get any documentation for it as everythings for Kendo now.

 

I'm trying to get partial views working with this window and using the .refresh() accompanied with the .open() method but i can't get the correct behaviour for this to work.

The URL has been set to one of the methods in the controller and it's not being hit at all and the window is just rendering blank with no items inside it.

 

Initially this screen was made dynamically using jquery as an iframe - which is why i've updated it to use a static Telerik window (not iframe) and using the .refresh() method but to no avail.

 

The window looks like the below:

 

01.@(Html.Telerik().Window()
02.    .Name("detailWindow")
03.    .Title("Edit Window")
04.    .Modal(true)
05.    .Draggable(true)
06.    .Width(200)
07.    .Height(100)
08.    .Visible(false)
09.)

 

And the jquery to perform the refresh looks as follows:

01.    var abc= $("#detailWindow").data("tWindow");
02.    abc.refresh({
03.        url: url, ==> this is a valid URL but controller isn't being hit
04.        title: "wat",
05.        data: {
06.            id: 1,
07.            id2: 2
08.        },
09.    });
10.     abc.center().open();

 

 

Is there some file that i'm missing or an issue with the above code?

 

 

Thanks

Nencho
Telerik team
 answered on 08 Mar 2018
4 answers
1.1K+ views

I have defined external template and trying to use it in kendo as mentioned here

Howevere when page rendered i get error in kendo.all.min.js "0x800a138f - JavaScript runtime error: Unable to get property 'replace' of undefined or null reference". not sure what im doing wrong. 

Also i'm passing ID's to javascript functions, i had to use single quote around ID's so cshtml wont show error, is that correct?

<div>
    @(Html.Kendo().Grid<Detail>()
    .Name("assetImportDetail")
    .Columns(col =>
    {
        col.Bound(p => p.Cost);
        col.Bound(p => p.Status);
        col.Bound(p => p.FileName);
        col.Bound(p => p.FileID).ClientTemplate("#=myTemplate(data)#").Title("Action");
    })
    .AutoBind(true)
    .Pageable()
    .Sortable()
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(20)
        .Read(read => read
            .Action("GetDetails", "MyDetail", new { ID = Model.ID })))
    )
</div>

 

<script>   
    var myTemplate = kendo.template($('#actionTemplate').html());
</script>
 
 
 
<script id="actionTemplate" type="text/x-kendo-template">
    # if (Status == "Error") { #
    <button class="resolve-button" onclick="Download('#= ID1#','#= ID2#');">Resolve</button>
    # } else if (Status == "Ready") { #
    <button class="approve-button" onclick="Approve('#= lID1 #');">Approve</button>
    # } else if (Status == "Imported") { #
    <button class="remove-button" onclick="Remove('#= ID1 #','#= ID2#');">Remove</button>
    #}#
</script>

Stefan
Telerik team
 answered on 08 Mar 2018
3 answers
376 views

I am trying to use the Grid / Checkbox selection feature in nested grids, inside client detail templates.

I am in face of a disturbing issue because the "select all" operation (by using the checkbox in the header) is always done in the first row having details.

 

To be clearer, suppose having a master grid with only 2 rows. Each row has a detail template containing a nested grid. Expand the 2 detail templates and try to select all the rows of the 2nd nested grid => That selects all the rows of the 1st one.

 

Have you an idea to help me ?

Thank you in advance.

 

Hereafter my shortened code of  the view (the full version is attached):

@(Html.Kendo().Grid<SellerViewModel>()

      .Name("SellersGrid")
      .Columns(columns =>
      {
          columns.Bound(p => p.SellerId).Hidden();
          columns.Bound(p => p.IsSelected);
          columns.Bound(e => e.Name);
          columns.Bound(e => e.IsActive);
      })
      .Events(e =>
      {
          e.DataBound("onHostSellersDataBound");
      })
      .Filterable()
      .Pageable(pager => pager.ButtonCount(3))
      .Editable(editable => editable.Mode(GridEditMode.InCell))
      .Sortable(sortable => sortable
          .AllowUnsort(true)
          .SortMode(GridSortMode.MultipleColumn))
      .ClientDetailTemplateId("marketplaces_template")
      .DataSource(dataSource => dataSource
          .Ajax()
          .Read(read => read.Action("GetHostSellers", "CompetitorGroup", new { competitorGroupId = Model.CompetitorGroupId }))
          .Sort(sort => sort.Add("IsSelected").Descending())
          .PageSize(25)
          .Model(model =>
          {
              model.Id(p => p.UniqueId);
              model.Field(p => p.SellerId).Editable(false);
              model.Field(p => p.IsSelected).Editable(true);
              model.Field(p => p.Name).Editable(false);
              model.Field(p => p.IsActive).Editable(false);
          })
          .ServerOperation(false))
)

<script id="marketplaces_template" type="text/kendo-tmpl">
    @(Html.Kendo().TabStrip()
          .Name("MarketplacesTabStrip_#=SellerId#")
          .SelectedIndex(0)
          .Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
          .Items(items =>
          {
              items.Add().Text("Marketplaces")
                  .Content(@<text>
                        @(Html.Kendo().Grid<SellerViewModel>()
                              .Name("MarketplacesGrid_#=SellerId#")
                              .HtmlAttributes(new {style = "height: 543px;"})
                              .Columns(columns =>
                              {
                                  columns.Select().Width(50);
                                  columns.Bound(p => p.SellerId).Hidden();
                                  columns.Bound(p => p.HostSellerId).Hidden();
                                  columns.Bound(p => p.IsSelected).Title("Inclus");
                                  columns.Bound(e => e.Name);
                                  columns.Bound(e => e.IsActive);
                              })
                              .Events(e =>
                              {
                                  e.DataBound("onMarketplacesDataBound");
                              })
                              .Filterable()
                              .Editable(editable => editable.Mode(GridEditMode.InCell))
                              .Scrollable(scrollable => scrollable.Virtual(true))
                              .Sortable(sortable => sortable
                                  .AllowUnsort(true)
                                  .SortMode(GridSortMode.SingleColumn))
                              .PersistSelection()
                              .Pageable(pager =>
                              {
                                  pager.ButtonCount(3);
                                  pager.Messages(msg => msg.Display("Marketplaces {0} à {1} - sur {2}"));
                              })
                              .DataSource(dataSource => dataSource
                                  .Ajax()
                                  .PageSize(500)
                                  .ServerOperation(false)
                                  .Read(read => read.Action("GetMarketplaces", "CompetitorGroup", new {competitorGroupId = Model.CompetitorGroupId, hostSellerId = "#=SellerId#"}))
                                  .Sort(sort => sort.Add("IsSelected").Descending())
                                  .Model(model =>
                                  {
                                      model.Id(p => p.UniqueId);
                                      model.Field(p => p.SellerId).Editable(false);
                                      model.Field(p => p.HostSellerId).Editable(false);
                                      model.Field(p => p.IsSelected).Editable(true);
                                      model.Field(p => p.Name).Editable(false);
                                      model.Field(p => p.IsActive).Editable(false);
                                  })
                              )
                              .ToClientTemplate())
                    </text>);

          })
          .ToClientTemplate())
</script>

Preslav
Telerik team
 answered on 08 Mar 2018
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
DropDownButton
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
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
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?