Telerik Forums
UI for ASP.NET MVC Forum
1 answer
209 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
515 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
840 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
904 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
376 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
243 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
2 answers
270 views

Please i need someone can help me with this problem.

I'm trying to send the selected rows into a controller when i click on the button with id="send", the issue is that when i tried to send other values( in this case a number and a string) with the selected rows values, the selected rows values is sending null to the controller but the number and the string isn't null in the controller parameters.

This is my javascript code that works fine if only i send the selected rows values:

$('#send').click(function () {
                var items = {};
                var grid = $('#grid').data('kendoGrid');
                var selectedElements = grid.select();

                for (var j = 0; j < selectedElements.length; j++) {
                    var item = grid.dataItem(selectedElements[j]);
                    items['grid[' + j + '].ParecidoCodigo'] = item.ParecidoCodigo;

                }
                $.ajax({
                    url: '@Url.Action("Index", "Busqueda")',
                    type: "POST",
                    async: false,
                    data: items,

                    success: function (result) {
                        console.log(result);
                    }
                })
            })

and this is my controller method action:

public ActionResult Index(MarcaParecido[] grid)
{

    ...

}

Everything works fine until now.

BUt when i tried to send another values like this:

$('#send').click(function () {
                var items = {};
                var grid = $('#grid').data('kendoGrid');
                var selectedElements = grid.select();
                var enviarDest = $('#destinatario').val();
                var marca = $('#numMarca').val();

                for (var j = 0; j < selectedElements.length; j++) {
                    var item = grid.dataItem(selectedElements[j]);
                    items['grid[' + j + '].ParecidoCodigo'] = item.ParecidoCodigo;

                }
                $.ajax({
                    url: '@Url.Action("Index", "Busqueda")',
                    type: "POST",
                    async: false,
                    data: { items, marcas: marca, destinatario: enviarDest },

                    success: function (result) {
                        console.log(result);
                    }
                })
            })

 

The selected rows values is sending me null, but hte others values isn't null

This is my controller now:

public ActionResult Index(MarcaParecido[] grid, string marcas, string destinatario)
        {...}

 

Please i really need your help with this, i don't know what else can i do to send all the values when i click the button.

I tried with JSON.stringify too but it doesn't work :(

 

I'll wait for your answers. Big hugs.

 

Juan
Top achievements
Rank 1
 answered on 21 Nov 2016
1 answer
387 views

I have a Telerik Grid for asp.net MVC 4 using Kendo 2014.
The grid has a 1 foreign key and I am using the foreign key template.

The Grid is working properly as far as CRUD operations, however, the GridData source is not getting updated. Consequently when trying to use the new updated values from the grid.dataSource (visible in the grid) I am getting the old values:

I have tried to update the datasource but am not able to get any of the prescribed datasource events events triggered  other than events.change which is not specific enough.

Here is my Grid:

@(Html.Kendo().Grid<PMTWebReconcile.Models.ProcEquipViewModel>()
              .Name("ProcEqGrid")
            //.HtmlAttributes(new { style = "height: 480px; margin-left: 260px" })
              .Events(events => events.Edit("onEdit"))//.Events(events => events.Change("onChange"))
              .Columns(columns =>
                {
                    columns.Bound(p => p.peqID).Width(20).Title("ID");
                    columns.Bound(p => p.peqName).Width(120).Title("Name");
                    columns.Bound(p => p.peqTag).Width(120).Title("Tag");
                    columns.Bound(p => p.peqDescription).Width(200).Title("Description");
                    columns.ForeignKey(p => p.eqtID, (System.Collections.IEnumerable)ViewData["EqptTypes"], "TypeID", "Type").Title("Eqpt Type").Width(200);
                  //columns.Bound(p => p.eqtID).Width(120).ClientTemplate("<span tabindex='0' class='k-widget k-dropdown k-header' unselectable='on'><span class='k-dropdown-wrap k-state-default' unselectable='on'><span class='k-input' unselectable='on'>Select Type</span><span class='k-select'><span class='k-icon k-i-arrow-s'>select</span></span></span><input name='Type' id='Type' style='display: none;' type='text' data-role='dropdownlist'></span>");
 
                         
                   columns.Bound(p => p.peqID).Width(10).Title("Edit Sizes")
                        .ClientTemplate("<button type='button' onclick=\"EditProcEquipment(this);\" text='text'  class='k-button k-button-icontext k-grid-edit' style='min-width: 30px; min-height: 25px;  height: 25px; padding-top: 0; padding-right: 0;'><span class='k-icon k-edit'></button>");
                    columns.Bound(p => p.peqActive).Width(30);
                    columns.Command(commands =>
                        commands.Edit().HtmlAttributes(new { style = "min-width:64px;width:80px" });
                           //commands.Delete().ButtonType(GridButtonType.Image);
                    }).Width(200);
                         
                  })
                  .ToolBar(toolbar => { toolbar.Create(); toolbar.Save(); }) // toolbar.Save(); })
                   //.ToolBar(toolBar => toolBar.Template("<a class='k-button k-button-icontext k-grid-add' href='#' onlick='customCreateCmd()'>Add new record</a>"))
                    .HtmlAttributes(new { style = "veritcal-align:top" })
                   .Selectable(s => s.Mode(GridSelectionMode.Single))
                                  //.Selectable(s => s.Mode(GridSelectionMode.Multiple))
                                  //.Editable(editable => editable.Mode(GridEditMode.InLine)) // Use inline editing mode.
                  .Editable(editable => editable.Mode(GridEditMode.InCell))
                  .Pageable()
                  .Sortable()
                  .Filterable()
                  .DataSource(dataSource =>  dataSource
                  .Ajax()
                  .Batch(true)
                  .ServerOperation(false)
                  .Events(events => events.Error("errorHandler").Sync("onSync").RequestEnd("onRequestEnd"))//.Sync("sync_handler"))
                   //.Events(events => events.RequestEnd("onRequestEnd"))
                   //.Events(events => events.Change("onChange"))
                   //.Events(events => events.Push("onPush"))
                   //.Events(events => events.Edit("onEdit"))
                  .AutoSync(true)
                  .Model(model =>
                          {
                            model.Id(p => p.peqID); // Specify the property which is the unique identifier of the model.
                            model.Field(p => p.peqID).Editable(false); // Make the ProductID property not editable.
                            //model.Field(p => p.Type).DefaultValue(new PMTWebReconcile.Models.EquipTypeViewModel());
                            model.Field(p => p.eqtID).DefaultValue(16);
                            model.Field(p => p.plsID);//need to come from treeview selector
                           //model.Field(p => p.plsID).DefaultValue(Html.Kendo().TreeView("tvPH").select());
                         })
                         .Read(read => read.Action("ForeignKeyColumn_Read", "PlantHierArchy", new { plsID = (subUnitID) }))
                         .Create(create => create.Action("ForeignKeyColumn_Create", "PlantHierArchy"))
                         .Update(update => update.Action("ForeignKeyColumn_Update", "PlantHierArchy").Type(HttpVerbs.Post).Data("UpdateHandler"))
                       )                       
                         //.ClientDetailTemplateId
              )

And my corresponding Update and Insert which are updating the Database Successfully.

[AcceptVerbs(HttpVerbs.Post)]
       public ActionResult ForeignKeyColumn_Create([DataSourceRequest] DataSourceRequest request,
           [Bind(Prefix = "models")]IEnumerable<ProcEquipViewModel> procEqs)
       {
           var results = new List<ProcEquipViewModel>();
           if (procEqs != null && ModelState.IsValid)
           {
               foreach (var proc in procEqs)
               {
                   CreateProcEquip(proc);
                   results.Add(proc);
               }
           }
 
           return Json(results.ToDataSourceResult(request, ModelState));
       }
[AcceptVerbs(HttpVerbs.Post)]
      public ActionResult ForeignKeyColumn_Update([DataSourceRequest] DataSourceRequest request,
          [Bind(Prefix = "models")]IEnumerable<ProcEquipViewModel> procEqs)
      {
          if (procEqs != null && ModelState.IsValid)
          {
              foreach (var proc in procEqs)
              {
                  //productService.Update(product);
                  UpdateProcEquip(proc);
              }
          }
 
          DataSourceResult DSR = procEqs.ToDataSourceResult(request, ModelState);
          JsonResult JR = Json(DSR);
          return JR;
      }

How can I update my data source?
additionally it would also be nice to be able to capture and update other update items but The grid.datasource is the most important.

Kostadin
Telerik team
 answered on 21 Nov 2016
1 answer
460 views

Hello Telerik team,

I just wanted to know if there are plans to decouple DataSourceRequest / DataSourceResult from the MVC subsystem ?

We want to use it between a WCF client and a WCF server but it does not serialize well with the SOAP MVC XML serializer.
We succeeded in serializing JSON in the WCF XMLmessage although it require us to convert/parse JSON to DataSourceRequest/DataSourceResult both at the client and the server.
By the way in order to achieve this the WCF hosting project has to reference a bunch of MCV assemblies just because the Kendo.Mvc.Ui assembly depends on it.

In addition to this serializing / deserializing JSON <-> DataSourceRequest/DataSourceResult is easy with the Newtonsoft JSON converter but it becomes complicated if we want to transfer an object instead of a JSON string (representing a serializable object similar to DataSourceRequest/DataSourceResult) ...

I may be wrong but it seems to me that all of this seems fairly complex for a task that sounds simple.

I saw the following post about using existing WCF service but I think this does work only with REST web service.

So is there any plan to be able :
 - to use DataSourceRequest / DataSourceResult in wcf xml serialization out of the box
 - to use the DataSourceRequest / DataSourceResult types in a convenient way without referencing all the MVC subsystem types (such as System.Web.Mvc.dll, System.Web.WebPages.dll, ...)

?

Thanks for your work and support,
 Dev

 
Ianko
Telerik team
 answered on 21 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
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?