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

I'm using a grid with editable mode set to pop up. On the actions I have included a route value to be sent to the controller. This route value gets sent on each of the CRUD calls except for the create. 

Below is my Grid code with the route values for each of the actions. I really only need this value passed through for the Create and Read actions.

@(Html.Kendo().Grid(Model).Name("ApprovalProcessSteps").Columns(c =>
{
    c.Bound(e => e.ProcessStep);
    c.Bound(e => e.ProcessStepType);
    c.Bound(e => e.AndOr);
    c.Bound(e => e.GroupParentStep);
    c.Bound(e => e.UserId);
    c.Bound(e => e.RejectToStep);
    c.Bound(e => e.ReminderFrequency);
 
    c.Command(command =>
    {
        command.Edit();
        command.Destroy();
    }).Width(200);
})
      .ToolBar(toolbar => toolbar.Create().Text("Create New Step"))
      .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("ApprovalProcessStepPopUp"))
      .Pageable(pager => pager.AlwaysVisible(false).PageSizes(new List<object> {5, 10, 20, 100}))
      .DataSource(dataSource => dataSource
          .Ajax()
          .PageSize(20)
          .Model(model => model.Id(p => p.Id))
          .Create(update => update.Action("EditingPopup_Create", "ApprovalProcessSteps", new { approvalProcessId = ViewBag.approvalProcessId }))
          .Read(read => read.Action("EditingPopup_Read", "ApprovalProcessSteps", new { approvalProcessId = ViewBag.approvalProcessId }))
          .Update(update => update.Action("EditingPopup_Update", "ApprovalProcessSteps", new { approvalProcessId = ViewBag.approvalProcessId }))
          .Destroy(update => update.Action("EditingPopup_Destroy", "ApprovalProcessSteps", new { approvalProcessId = ViewBag.approvalProcessId })))
      )

 

Below is my controller code. The route value gets pass to all but my Create call. Can any point me in the right direction on what I might be doing wrong.

public ActionResult EditingPopup_Read([DataSourceRequest] DataSourceRequest request, int approvalProcessId)
{
    ViewBag.approvalProcessId = approvalProcessId;
    return Json(this.ReadInline(approvalProcessId).ToDataSourceResult(request));
}
 
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult EditingPopup_Create([DataSourceRequest] DataSourceRequest request, ApprovalProcessStep approvalProcessStep, int approvalProcessId)
{
    if (approvalProcessStep != null && ModelState.IsValid)
    {
        this.CreateInline(approvalProcessStep, approvalProcessId);
    }
 
    return Json(new[] {approvalProcessStep}.ToDataSourceResult(request, ModelState));
}
 
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult EditingPopup_Update([DataSourceRequest] DataSourceRequest request, ApprovalProcessStep approvalProcessStep)
{
    if (approvalProcessStep != null && ModelState.IsValid)
    {
        this.UpdateInline(approvalProcessStep);
    }
 
    return Json(new[] {approvalProcessStep}.ToDataSourceResult(request, ModelState));
}
 
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult EditingPopup_Destroy([DataSourceRequest] DataSourceRequest request, ApprovalProcessStep approvalProcessStep)
{
    if (approvalProcessStep != null)
    {
        this.DestroyInline(approvalProcessStep);
    }
 
    return Json(new[] {approvalProcessStep}.ToDataSourceResult(request, ModelState));
}
Georgi
Telerik team
 answered on 03 Jul 2018
12 answers
2.4K+ views
Hi,
I need to include MultiSelect list in grid which should show already assigned values as selected and if user wants  to assign more then he can select from select list.
I have attached screenshot the way i want select list in grid.
Please reply.
Boyan Dimitrov
Telerik team
 answered on 02 Jul 2018
12 answers
1.4K+ views

Hi,

I'm using an EditorTemplate to enable the user to select a person

@model Int64

@(Html.Kendo().ComboBox()
            .Name("RepIRN")
            .Filter("contains")
            .Placeholder("Select a rep...")
            .DataTextField("Text")
            .DataValueField("Value")
       .HtmlAttributes(new { style = "width:100%;" })
          .Filter("contains")
          .AutoBind(false)
          .MinLength(3)
          .DataSource(source =>
          {
            source.Read(read =>
            {
              read.Action("GetUsers", "AutoComplete");
            })
            .ServerFiltering(true);
          })
)

 

The model that I'm displaying is

 

 public class JobObjectModel
  {
    public long IRN { get; set; }
    public string Rep { get; set; }

    [UIHint("RepEditor")]
    public long RepIRN { get; set; }

    public string JobStatus { get; set; }
    public string Promised { get; set; }
 }

The combobox works fine except I can't figure out how I populate it with the rep value and rep name when the page loads the model.Everything else seems to work, if the user selects a value it is sent back to the controller fine etc.

I just can't figure out how I load the value (and text) when the page loads.

Below is how I populate the combobox

 

   public JsonResult GetUsers(string text)
    {

    var sortedPeople = Database.GetPeople(text);
      List<SelectListItem> items = new List<SelectListItem>();
      foreach (var person in sortedPeople)
      {
        items .Add(new SelectListItem() { Text = person.FullName, Value = person.IRN.Value.ToString() });
      }

      return Json(items , JsonRequestBehavior.AllowGet);
    }

Stefan
Top achievements
Rank 1
Iron
 answered on 02 Jul 2018
2 answers
918 views

Hi Team,

 

I have a grid with columns that has dropdownlists. I am using EditorTemplates for these dropdownlists. My concern is that I am unable to make these columns readonly on Edit. However, I am able to make the other non-dropdown columns to do the same behaviour and it works.

 

this is my column setup:

columns.Bound(a => a.Account).ClientTemplate("#=Account.AccountName#").Width(200); 

columns.Bound(a => a.dtEffectiveDate).Width(200);

 

this is my editor template:

@model GlobalCommissionAndAccountAssignments.Models.AccountUpdate.AccountModel
@{
    ViewBag.Title = "AccountsList";
}

@(Html.Kendo().DropDownListFor(m => m)
                                    .DataValueField("AccountId")
                                    .DataTextField("AccountName")
                                    .BindTo((System.Collections.IEnumerable)ViewData["accounts"])
)

 

My code t o make these columns as read-only on edit:

.Events(e => e.Edit("onGridEdit"))

<script>

    function onGridEdit(e) {
        if (e.model.isNew() == false) {
            $('input[name=dtEffectiveDate]').parent().html(e.model.dtEffectiveDate); ----> this works
            $('input[name=Account]').parent().html(e.model.Account); ----> this does not work (the one using a model and client template and editor template)
        }
    } 

</script>

Thank you in advance.

Sam

 

Samyukta
Top achievements
Rank 1
 answered on 29 Jun 2018
1 answer
427 views

Hello All,

Let me first start by saying that I am well aware of the Drag & Drop example for Kendo UI for jQuery.

What am I looking for is an example of Drag & Drop between Kendo Grids using the ASP.NET MVC structure and syntax.  Does this capability even exist in ASP.NET MVC or is it only limited to Kendo UI for jQuery?

Thanks in advance for any help regarding this question.

Best,

Will

Alex Hajigeorgieva
Telerik team
 answered on 29 Jun 2018
1 answer
147 views

If I put this html code in the editor and then save it:

<table>
<tr>
<td>
<p><i class="fa fa-check" style="color: green;">&nbsp;</i></p>
</td>
</tr>
</table>

 

When I look at the HTML again it looks like this:

 

<table><tbody><tr><td>&nbsp;</td>
</tr>
</tbody></table>

It strips out the Italics tag. Normally this wouldn't be a problem but we using Font Awesome and this messes that up. I noticed that it only does this if it's in a table, if I put that same italics tag outside the table it works fine. I was able to verify this same behavior using the online demo page.

I am using Kendo UI v2018.1.221 


Ianko
Telerik team
 answered on 29 Jun 2018
12 answers
302 views

Hi,

I've got the chart how i would like it apart form having multiple category axis, please see attached image.

As you can see i have one CategoryAxis working the persons name, ideally i'd like each Column name to appear above that.(series.stack)

Here's my current code:

@(Html.Kendo().Chart()
                     .Name("chart")
                     .Title("Project Management")
                     .Legend(legend => legend
                         .Position(ChartLegendPosition.Top)
                     )
                     .SeriesDefaults(seriesDefaults =>
                         seriesDefaults.Column().Stack(true)
                     )
                     .Series(series =>
                     {
                         foreach (var def in Model.Series)
                         {
                             series.Column(def.Data).Name(def.Name).Stack(def.Stack);
                         }
                     })
                     .SeriesColors(Colours.Blue, Colours.Orange, Colours.Grey, Colours.Yellow, Colours.LightBlue, Colours.Green)
                     // This should be the Stack Name (Overhead)
                     .CategoryAxis(axis => axis.Labels(l => l.Rotation(90).Template("#= series.stack #")))
                     // This should be the Persons Name (FullName)
                     .CategoryAxis(axis => axis.Categories(Model.Categories))
                     .Tooltip(tooltip => tooltip
                         .Visible(true)
                         .Template("#= series.name #: #= kendo.format('{0:N2}', value) #")
                     )
               )

 

What's the easiest way to achieve this? This is based off of your example project: https://github.com/telerik/ui-for-aspnet-mvc-examples/tree/master/chart/dynamic-series

Thanks,
Lee.

 

Tsvetina
Telerik team
 answered on 28 Jun 2018
3 answers
449 views

Hi,

I have a view with a text box , button and two grids. The intention is to populate the two grids with data, when the text box is supplied with a string value and the button is clicked. Since, kendo().TextBox() does not support Events, I have introduced the button which when clicked updates both the grids as below:

 

        $("#get").click(function () {
            var value = $("#customerInfo").data("kendoTextBox");
          
                $("#gridCurrent").data("kendoGrid").dataSource.read();
                $("#gridAll").data("kendoGrid").dataSource.read();      

        });

This works fine. However after the grids are loaded, I am unable to add a new record to the grid, the Add New Record button on the grid does not work. Any suggestions on this?

Note: I had to use a text box because, the input value is a alphanumeric (varying size) and I found no suitable component.

 

Thank you in advance.

Sam

 

 

 

 

Viktor Tachev
Telerik team
 answered on 28 Jun 2018
2 answers
283 views
I have a grid with a custom toolbar button to do a "global" update to the grid items. The Action is a normal MVC controller that returns a JsonResult. The action works correctly, but I'm not sure how to correctly handle the response - IE is asking if I want to download or open the JSON response. What I need to do is check the response for success, and refresh the grid or display an error message. How can I wire this up? Apologies if there's an answer already - I've searched, but can't seem to find anything.
Harper
Top achievements
Rank 1
 answered on 27 Jun 2018
3 answers
5.4K+ views
I have a column that has HTML formatted data, and excel doesn't play nice with HTML.  Since it doesn't display HTML without jumping through hoops, I just decided to hide that column when I do my export.

I saw there was an excelExport event in the Javascript library that I could intercept and hide the column, but I don't seem to have that option in the .Events wrapper in the MVC library, is it possible to hide a column before exporting to excel since my first choice of writing the HTML probably isn't going to work?
Prakash
Top achievements
Rank 1
 answered on 27 Jun 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
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
LLM Kit
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?