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

Hello,

selecting a DropDownList inside of a window-control results in a scrollbar on the side of the window-control. How can I prevent that?

I attached a screenshot so you can see what I am talking about.

Thanks in advance.

Oliver
Top achievements
Rank 1
 answered on 29 Sep 2015
1 answer
224 views

Assuming I have the below table:

@Html.Kendo().Grid(Model).Name("Staff").Columns(x =>{         x.Bound(y => y.StaffId);         x.Bound(y => y.FirstName);         x.Bound(y => y.LastName);         x.Bound(y => y.Email);         x.Bound(y => y.Phone);         x.Command(y => y.Custom("Edit").Action("edit", "controller", new { id = ????? }));}).Sortable().Scrollable().Pageable(x=> x.PageSizes(true)).Filterable()

 

How can I pass the primary key value (StaffId in this case) associated to the row to the object route values similar to the way it is done by Visual Studio auto-scaffold? I do not want a Java Script based solution. I am just looking for a way to pass the current row id (PK) to server action. Is it possible?

For more information please refer this SO thread.

Boyan Dimitrov
Telerik team
 answered on 29 Sep 2015
1 answer
243 views
Hello,
 I want to change combobox width but I have problem with ​styling. I attached screen capture, I tried two way for set combo width but not working well. I using bootstrap in my project. How can I fix this problem?

Here is my code,

<div class="form-group">
            @Html.LabelFor(model => model.MusteriId, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">              
                @(Html.Kendo().ComboBox()
          .Name("MusteriId")
          .Filter("contains")
          .Placeholder("Müşteri seçiniz...")
          .BindTo(ViewBag.MusteriId as SelectList)
          .Suggest(true)
          .HtmlAttributes(new { style = "width: 600px;" })
                )
                @Html.ValidationMessageFor(model => model.MusteriId, "", new { @class = "text-danger" })
            </div>
        </div><div class="form-group">
            @Html.LabelFor(model => model.AracId, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">               
                @(Html.Kendo().ComboBox()
          .Name("AracId")
          .Filter("contains")
          .Placeholder("Araç seçiniz...")
          .BindTo(ViewBag.AracId as SelectList)
          .Suggest(true)
          .HtmlAttributes(new { style = "width: 85%;" })
                )
                @Html.ValidationMessageFor(model => model.AracId, "", new { @class = "text-danger" })
            </div>
        </div>
Artuğ
Top achievements
Rank 1
 answered on 28 Sep 2015
1 answer
375 views

Hi, 

I'm working with telerik mvc grid, I'm trying to use the grid for crud operations, my model is supposed to have an id key which is stored in the model view item ut the user is not supposed to even know the id property can you help me not showing the id field in the edit popup. 

 

 

Best 

A. Guzman 

Dimiter Madjarov
Telerik team
 answered on 28 Sep 2015
1 answer
449 views

Hi, I've been working with telerik mcv grid, i've used a modelview to pass the data to the controller. Now i want the user to be available to edit the row information but every time the user presses the edit button on the grid the modal window shows the item id which is not suposed to be displayed

 This is the modelview 

public class EmpleadoViewModel
    {
        public int EmpleadoID { get; set; }
         
        [Required]
        public String Nombre { get; set; }
 
        [Required]
        public String Email { get; set; }
 
        [Required]
        public String Activo { get; set; }
 
        [Required]
        public String Role { get; set; }
    }

 

 This is the grid config

@(Html.Kendo().Grid<EmpleadoViewModel>()
               .Name("people_grid")
               .Columns(columns =>
               {
                   columns.Bound(e => e.Nombre).Title("Nombres").HeaderHtmlAttributes(new { style = "text-align:center" });
                   columns.Bound(e => e.Email).Title("E-Mail").HeaderHtmlAttributes(new { style = "text-align:center" });
                   columns.Bound(e => e.Activo).Title("Estado").HeaderHtmlAttributes(new { style = "text-align:center" });
                   columns.Bound(e => e.Role).Title("Rol de sitio").HeaderHtmlAttributes(new { style = "text-align:center" });
                   columns.Command(command =>
                   {
                       command.Edit().Text("Editar").HtmlAttributes(new { @class = "sharp", onmouseover = "editBtnPopover(this)", onmouseout="hidePopover(this)" });
                       command.Custom("Deshabilitar").Click("disablePerson").HtmlAttributes(new { @class = "sharp", onmouseover = "disableBtnPopover(this)", onmouseout = "hidePopover(this)" });
 
                   }).Title("Acciones").HeaderHtmlAttributes(new { style = "text-align:center" });
               })
               .ToolBar(toolbar =>
               {
                   toolbar.Create().Text("Nuevo").HtmlAttributes(new { id="new_btn" });
                   
               })
               .HtmlAttributes(new { style = "height:550px;" })
               .Editable(editable =>
                   editable.Mode(GridEditMode.PopUp).Window(window =>
                   {
                       window.Draggable(false);
                       window.Title("ICS: Personas");
                   }))
               .Scrollable()
               .Sortable()
               .Pageable(pageable =>
               {
                   pageable.Refresh(false);
                   pageable.PageSizes(true);
                   pageable.ButtonCount(5);
               })
                
               .Events(events => events.Change("getSelectedItem"))
               .DataSource(dataSource => dataSource
                   .Ajax()
                    
                   .PageSize(10)
                   .Model(model =>
                   {
                       model.Id(emp => emp.EmpleadoID);
                       model.Field(emp => emp.EmpleadoID).Editable(false);
                   })
                   .Create(update => update.Action("EditingPopup_Create", "Grid"))
                   .Read(read => read.Action("Read_Alpes_Employees", "Demo"))
                   .Update(update => update.Action("EditingPopup_Update", "Grid"))
                   .Destroy(update => update.Action("EditingPopup_Destroy", "Grid"))
               )
           )

 

Boyan Dimitrov
Telerik team
 answered on 28 Sep 2015
1 answer
380 views

Hi, 

I'm working with telerik grid and using a custom modelview element to pass the data to the controller, when the user presses the Edit button inside the grid it should display the modelview item information or at least the information I want it to show, but so far just errors and an inconsistent look and feel when I use telerik controllers,

I've configured the Edit command to only show all fields of my viewmodel except the item id, but every time it keeps showing the item id,  

This is my modelview item class 

public class EmpleadoViewModel
    {
 
       public int EmpleadoID { get; set; }
         
        [Required]
        public String Nombre { get; set; }
 
        [Required]
        public String Email { get; set; }
 
        [Required]
        public String Activo { get; set; }
 
        [Required]
        public String Role { get; set; }
    }

 This is the grid settings 

@(Html.Kendo().Grid<EmpleadoViewModel>()
               .Name("people_grid")
               .Columns(columns =>
               {
                   columns.Bound(e => e.Nombre).Title("Nombres").HeaderHtmlAttributes(new { style = "text-align:center" });
                   columns.Bound(e => e.Email).Title("E-Mail").HeaderHtmlAttributes(new { style = "text-align:center" });
                   columns.Bound(e => e.Activo).Title("Estado").HeaderHtmlAttributes(new { style = "text-align:center" });
                   columns.Bound(e => e.Role).Title("Rol de sitio").HeaderHtmlAttributes(new { style = "text-align:center" });
                   columns.Command(command =>
                   {
                       command.Edit().Text("Editar").HtmlAttributes(new { @class = "sharp", onmouseover = "editBtnPopover(this)", onmouseout="hidePopover(this)" });
                       command.Custom("Deshabilitar").Click("disablePerson").HtmlAttributes(new { @class = "sharp", onmouseover = "disableBtnPopover(this)", onmouseout = "hidePopover(this)" });
 
                   }).Title("Acciones").HeaderHtmlAttributes(new { style = "text-align:center" });
               })
               .ToolBar(toolbar =>
               {
                   toolbar.Create().Text("Nuevo").HtmlAttributes(new { id="new_btn" });
                   
               })
               .HtmlAttributes(new { style = "height:550px;" })
               .Editable(editable =>
                   editable.Mode(GridEditMode.PopUp).Window(window =>
                   {
                       window.Draggable(false);
                       window.Title("ICS: Personas");
                   }))
               .Scrollable()
               .Sortable()
               .Pageable(pageable =>
               {
                   pageable.Refresh(false);
                   pageable.PageSizes(true);
                   pageable.ButtonCount(5);
               })
                
               .Events(events => events.Change("getSelectedItem"))
               .DataSource(dataSource => dataSource
                   .Ajax()
                    
                   .PageSize(10)
                   .Model(model =>
                   {
                       model.Id(emp => emp.EmpleadoID);
                       model.Field(emp => emp.EmpleadoID).Editable(false);
                   })
                   .Create(update => update.Action("EditingPopup_Create", "Grid"))
                   .Read(read => read.Action("Read_Alpes_Employees", "Demo"))
                   .Update(update => update.Action("EditingPopup_Update", "Grid"))
                   .Destroy(update => update.Action("EditingPopup_Destroy", "Grid"))
               )
           )

 So far I'm very unhappy with your product, I can't modify certain things and also every time I use telerik it  messes my whole page design!!!! 

 

Boyan Dimitrov
Telerik team
 answered on 28 Sep 2015
2 answers
386 views

I have a hierarchical grid, containing a list of records, with their associated actions.

 When an action is inserted, the data repository will adjust the status of the master record, according to the action type that has been inserted.  This works, however I'm having difficulty refreshing the master grid to reflect the change in status.

I have put a handler on the action grids (the sub grid) save event, however this fires before the database change has been saved, so the change to the master grids data isn't reflected?

 What event can I handle to refresh the master grid once the data has been saved?

The code is:-

 

@(Html.Kendo().Grid<SimpleChangeControl.Models.View_Action>()
                       .Name("ActionsGrid_#=ID#")
                        .Events(e => e.Edit("onSubEdit"))
                       .Columns(columns =>
                       {
                           columns.Bound(o => o.ID).Title("ID");
                           columns.Bound(o => o.ActionType).Title("Type").ClientTemplate("<span>\\#=ActionTypeDescription\\#</span>").Filterable(f => f.UI("actionTypeFilter"));
                           columns.Bound(o => o.Description).Title("Description");
                           columns.Command(command => { command.Edit(); command.Destroy(); });
 
 
                       })
                       .Filterable(f => f
   .Extra(false)
   .Operators(o => o
   .ForNumber(str => str.Clear()
   .IsEqualTo("Equals"))))
                         .ToolBar(commands => commands.Create())
                       .Editable(editable => editable
                   .Mode(GridEditMode.PopUp))
                       .DataSource(dataSource => dataSource
                           .Ajax()
                           .Events(e => e.Error(@<text> function(e){subError(e,"ActionsGrid_#=ID#")} </text>))
                            .Model(m => m.Id(p => p.ID))
                           .PageSize(10)
 
                           .Read(read => read.Action("RD_Actions", "ChangeRequests", new { ChangeRequestID = "#= ID #" }))
 
                           .Create(create => create.Action("InsertAction", "ChangeRequests", new { CRID = "#= ID #" }))
                           .Update(update => update.Action("UpdateAction", "ChangeRequests"))
                           .Destroy(delete => delete.Action("DeleteAction", "ChangeRequests"))
                            
                           )
                           .Filterable()
                           .Events(e=>e.Save("actionSave"))
                           .Pageable(p => p.Refresh(true))
 
                           .ToClientTemplate())

 The handler is:-

 

function actionSave()
   {
      var grid = $('#Grid').data("kendoGrid");
 
       grid.dataSource.read();
   }

 

AP
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 28 Sep 2015
1 answer
344 views

I have a grid defined thusly: 

@Model VendorManagement.Web.Models.RiskExposureViewModel
@using Kendo.Mvc.UI

@(Html.Kendo().Grid(Model.RiskMatrixExposureList)

     .Name("grdRiskMatrix")
     .Columns(columns =>
     {
                                columns.Bound(c => c.RiskUnit).Title("Risk Unit");
                                columns.Bound(c => c.RiskCategory).Title("Risk Category");
                                columns.Bound(c => c.RiskDescription).Title("Short Description");
                            })
                            .Read(read => read.Action("BindRiskMatrixGrid", "Risk"))
                            .Pageable()
)

RiskMatrixExposureList is a List<RiskMatrixExposure>. The grid as defined is throwing the following error in Razor:

"Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type"

 I have the namespace defined in Views/web.config:

 <system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Optimization"/>
        <add namespace="System.Web.Routing" />
        <add namespace="VendorManagement.Web" />
        <add namespace="Kendo.Mvc.UI" />
      </namespaces>
    </pages>
  </system.web.webPages.razor>

 

Thanks for they help!

 

Nikolay Rusev
Telerik team
 answered on 28 Sep 2015
1 answer
195 views

I have a Target field in my PopupEditor that's using custom List to display a dropdown in the View. I want the first item in the custom list (Self) to show as the default value in the dropdown.

View:

@Html.LabelFor(model => model.Target, new { @class = "col-sm-5 control-label" })
<div>
    @Html.EditorFor(model => model.Target)
</div>

Controller:

public ActionResult Index()
{
    ViewData["Targets"] = ixList.Targets();
 
    return View();
}

Custom List (ixList):

public static List<TargetsModel> Targets()
{
    List<TargetsModel> targets = new List<TargetsModel>();
 
    targets.Add(new TargetsModel { Description = "Self", Target = "_self" });
    targets.Add(new TargetsModel { Description = "Blank", Target = "_blank" });
 
    return targets;
}

Model:

[UIHint("GridForeignKey")]
public string Target { get; set; }  // target = _blank, _self

 

How would I go about setting the first item Self to the default value? Right now the default value appears to be null.

 

 

Vladimir Iliev
Telerik team
 answered on 28 Sep 2015
1 answer
84 views

I have an ID and status for every job and I need to grab that ID and status when I double click on the job. Is it possible to set attributes for the job ID and status and then catch those with jQuery?

 

Thanks in advance.

Vladimir Iliev
Telerik team
 answered on 28 Sep 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?