Telerik Forums
UI for ASP.NET MVC Forum
1 answer
96 views

Requirements

Telerik Product and Version

2014.3.1411.440

Supported Browsers and Platforms

GoogleChrome

Components/Widgets used (JS frameworks, etc.)

UIGrid


PROJECT DESCRIPTION 
[enter description here, together with step-by-step instructions on how to use the project]
We have several pages where we have noticed that the sorting of the grid is not working. We are attempting to sorty by four columns but to no luck we are able to get the desired results.. Attached is a sample of the binding as well as the controller method that retrieves the method.

I have tried binding it both in the controller using OrderBy, ThenBy extensions as well as the sort in the grid binding. Additionally I have also sorted the results within the method that the controller calls and have reviewed it with LinqPad and it appears to be sorting correctly. However I cannot get it bind sorted in the grid. Any help will be appreciated.

Grid Binding

Scrollable(a => a.Height("auto"))
                  .Sortable()
                  .PrefixUrlParameters(false)
                  .Filterable()
                  .Pageable(pageable => pageable
                      .Refresh(true)
                      .PageSizes(new[] { 50, 100, 250, 500, 1000 })
                      .Messages(messages => messages.ItemsPerPage(" items are currently displayed"))
                      .ButtonCount(5))
                  .DataSource(dataSource => dataSource
                      .Server().PageSize(250)
                      .Sort(s =>
                          {
                              s.Add(c => c.EAN).Ascending();
                              s.Add(c => c.IngramSku).Ascending();
                              s.Add(c => c.BusinessYear).Descending();
                              s.Add(c => c.BusinessMonth).Descending();                             

 

Controller Method Logic

var viewModel = new ViewModels.RAM.VendorQuarterlyRevenueViewModel()
           {
               VendorId = vendorId,
               VendorName = GetVendorName(vendorId),
               sort = sort,
               filter = filter,
               group = group,
               ShowDataGrid = true,
               ReportDate = new ViewModels.RAM.ReportDateViewModel()
               {
                   BeginDate = beginDate,
                   EndDate = endDate,
                   MaxDate = maxDate,
                   MinDate = minDate,
               },
               VendorQuarterlyRevenueData = _ramReportRepository.GetVendorQuarterlyRevenue(_ramReportRepository.GetContext(), beginDate, endDate, vendorId)
           };
 
           if (dataSourceRequest.Filters != null)
           {
               viewModel.VendorQuarterlyRevenueData = (IQueryable<VendorRevenueModel>)viewModel.VendorQuarterlyRevenueData.Where(dataSourceRequest.Filters);
           }
 
 
           foreach (var item in viewModel.VendorQuarterlyRevenueData)
           {
               viewModel.FreightRevenueSum += item.FreightRevenue;
               viewModel.NetSalesSum += item.NetSales;
               viewModel.RentalIncomeSum += item.RentalIncome;
           }
 
 
           return View("VendorQuarterlyRevenueReport", viewModel);

 

Vasil
Telerik team
 answered on 23 Nov 2016
1 answer
1.3K+ views

This is the situation: I have a form that when i click in the submit button is sending a file with the kendo upload control, and the method action of the controller is receiving that file in the parameter with the HttpPostedFileBase.
This is my HTML code:

 

@using (Html.BeginForm("ConfirmarOposicion", "Gestion", FormMethod.Post, new { @id = "Frm-login", role = "form", @class = "form-horizontal" }))

{

    @(Html.Kendo().Upload()

        .Name("files")

    )

    <button class="btn btn-success" type="submit" id="confirm" >Confirm</button>

}

And this is my controller:

public async Task<ActionResult> ConfirmarOposicion(IEnumerable<HttpPostedFileBase> files)

{

    // Here the parameter files is not null..

}

Here is working all good till now. The problem is when i try to send more values as parameter into the same method of the controller. The other values that i want to send is an array, and the other is a number. This two values i try to send with ajax in javaScript.
This is my javaScript code when i try to send those two more values:

$("#confirm").click(function ()

{

    var numMarca = $("#numMarca").val()

    var idsToSend = [];

    var grid = $("#Grid2").data("kendoGrid")

    var ds = grid.dataSource.view();

    for (var i = 0; i < ds.length; i++)

    {

        var row = grid.table.find("tr[data-uid='" + ds[i].uid + "']");

        var checkbox = $(row).find(".checkbox");

        if (checkbox.is(":checked"))

        {

            idsToSend.push(ds[i].DescMarca);

            idsToSend.push(ds[i].IntencionOposicion = 1);

        }

        else

        {

            idsToSend.push(ds[i].DescMarca);

        }

    }

    $.ajax({

        url: '@Url.Action("ConfirmarOposicion", "Gestion")',

        data: { ids: idsToSend, marca: numMarca },

        type: 'POST',

        dataType: "json",

        success: function (data)

        {

             ...

        }

 

When i clik the submit button is sending this two values in the same controller that i send the input file.
And this my controller now:

public async Task<ActionResult> ConfirmarOposicion(IEnumerable<HttpPostedFileBase> files, string[] ids, string marca)

{

    // here the array ids and the value of marca is not null, but the parameter files it is null

}

And that's the issue that i have.
I need to send all those values in the same method action of the controller.
How can i do that?

Peter Milchev
Telerik team
 answered on 23 Nov 2016
1 answer
322 views

This is a two part question, first how do I know what controller parameters are needed fro the update action for the tree view (Same question applies to all Kendo controls) No error is thrown so I don't known what route (route signature) to build.

 

Second, could be related to the first my action is public JsonResult Update([DataSourceRequest] DataSourceRequest request, ProductViewModel product) but when I do a drag and drop the action isn't fired.  I have found when this happens typically it is because I don't have a matching signature for the route... but again no error is thrown so I can't debug it. 

 

Thanks in advance and sorry if I am not using the correct terminology for this.

Viktor Tachev
Telerik team
 answered on 23 Nov 2016
1 answer
196 views

Hi,

it seems that the selection in the AutoComplete is not correct (see attached Pictures) - it should be the same as the other Dropdowns (Combo, list)

robert

Nencho
Telerik team
 answered on 23 Nov 2016
1 answer
504 views

I would like to refersh a layer in a kendo Map,  there are 8 layers, but only want to refresh layer 1. 

 

This would occur on a button click event.

 

my datasource for the layer is

.DataSource(source => source
                        .Custom()
                        .Transport(transport => transport
                        
                            .Read(read =>
                            {
                                read.Url("/Api/EventInfo/_P4BubbleAreas/" + Model.showEventP4.ToString())
                                    .DataType("json");
                            })
                        )
                    )

Danail Vasilev
Telerik team
 answered on 23 Nov 2016
1 answer
811 views

Hi,

I have a partial view that is referring to a model. I can open multiple models at the same time, which reflects in having that particular partial view shown multiple times.

The problem now is that every controlinside of it has an id (grids, multiselects ...), and by showing it multiple times I get into the situation that I have multiple controls with a same id.

Actually I can open it just 2 times, bcz then the controls get "broken" and dont load properly anymore (I need to refresh the page to get it working again).

 

Is there a way around that, best practice or smt ?

Regards

 

 

Konstantin Dikov
Telerik team
 answered on 23 Nov 2016
2 answers
884 views

Hi,

i want to change the text color of a foreign key column depending on the values of two other columns.

I do this for a bounded column using a client template:

columns.Bound(p => p.CompanyAlternative).ClientTemplate("# if ( LeIdOriginal === LeIdAlternative) { # <div> #= CompanyAlternative # </div> # } else { # <div style='color: rgb(225,0,15);'> #= CompanyAlternative # </div> # } #");

But how can i achieve this for a foreign key?

 

Thanks

Michael

Michael
Top achievements
Rank 1
 answered on 22 Nov 2016
1 answer
1.1K+ views

Hello,

I have a custom command column in my grid as seen below.  I would like to change the text of the button from "Activate" to "Deactivate" based on 2 other cells values in the row.  How can I do this?  Thanks.

col.Command(command => command.Custom("Activate").Click("activate_deactivate")).Locked(true).Width(140);
Eyup
Telerik team
 answered on 22 Nov 2016
17 answers
336 views

Hi,

I have pretty complex appointment classes (with lots of dependencies). Now when I want to display them inside the scheduler I just read the most important information (start, end, title ...). But when I want to edit the appointment with my custom template, I want to load all the additional information (it would be too slow to load all that data for the scheduler).

So is there a possiblity to "reload" my object before showing it inside the template ?

 

Regards

Semir

Veselin Tsvetanov
Telerik team
 answered on 22 Nov 2016
1 answer
229 views

I have a grid that I want to display inside a ClientTemplate, but the datasource is not binding

What am I missing to get the bind to occur.

Thanks

 

 

@(Html.Kendo().Grid<WebSite.Library.Models.SiteCriteria>()
.Name("siteCriteriaCriteria")
.Columns(columns =>
{
columns.Bound(p => p.siteId).Title("siteId").Width(50).Hidden();
//columns.Bound(p => p.premiseAreaId).Title("premiseId").Width(50).Hidden();
columns.Bound(p => p.areaId).Title("AreaId").Width(50).Hidden();
columns.Bound(p => p.name).Title("Hazard Area").Width(150);
columns.Template(p => "").Title("criteria").ClientTemplate(
Html.Kendo().Grid<WebSite.Library.Models.SiteCriteria>()
.Name("areaCriteria#=areaId#")
.Columns(c =>
{
c.Bound(e1 => e1.name).Title("Training").Width(100);
})
.AutoBind(true)
.DataSource(source1 => source1
.Custom()
.Transport(transport => transport
.Read(read =>
{
read.Url("/Api/SiteInfo/_getTrainingAreas/_si=12117")
.DataType("json");
})

))

.ToClientTemplate()
.ToHtmlString()
);
})
//.Events(events => events.Remove("onRemove"))
.NoRecords("No criteria exists.")
.DataSource(source => source
.Custom()
.Transport(transport => transport
.Read(read =>
{
read.Url("/Api/SiteInfo/_getPremiseArea/_si=" + Model.SiteId )
.DataType("json");
})
))
)

Kostadin
Telerik team
 answered on 22 Nov 2016
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
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
SmartPasteButton
PromptBox
SegmentedControl
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?