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

I'm evaluating the spreadsheet component for possible use and I ran into an issue with saving changes to sorted data in the spreadsheet.  I'm binding a datasource into a sheet with CRUD references to the controller.  When the data is sorted and a user edits a row, on saving the update, the wrong row in the datasource is updated/sent to the controller.  Is this a known issue?  If so, do you know when this will be corrected?

Thanks.

Scott

 

Veselin Tsvetanov
Telerik team
 answered on 08 Dec 2016
1 answer
809 views

Enum class

public class Voltage
  {
      public int Id{ get; set; }
      public string RefNo { get; set; }
      public VoltageLevel VoltageLevel { get; set; }
  }
  public enum VoltageLevel
  {
      LV = 1,
      MV = 2,
      HV = 3  
}

 

Controller

public ActionResult Voltage_Read([DataSourceRequest]DataSourceRequest request)
     {
         IQueryable<Voltage> voltage= db.Voltage;
         DataSourceResult result = voltage.ToDataSourceResult(request, voltage=> new {
             Id = voltage.Id,
             RefNo = voltage.RefNo,
             VoltageLevel = voltage.VoltageLevel,
         });
         return Json(result);
     }

 

View

@(Html.Kendo().Grid<entities.voltage>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(c => c.RefNo);
columns.Bound(c => c.VoltageLevel); //here the voltagelevel didnt show.
})

 

 

Marin Bratanov
Telerik team
 answered on 08 Dec 2016
1 answer
113 views

Kendo Grid creates some dynamic id like 90gaedac-c800-4582-b530-4f7145383554 and they sometimes start with a number, which is against the standard.

https://css-tricks.com/ids-cannot-start-with-a-number/

Is there a way to fix this behaviour?

Konstantin Dikov
Telerik team
 answered on 08 Dec 2016
3 answers
334 views

Hello, I'm using a cascading combobox in an editor template.  The Id is set dynamically to avoid conflict with multiple instances of the editor on the same page.  So for example I might setup the editor like this:

 

@Html.EditorFor(o => o.MatterNum, "MatterComboBox", new { ControlId = "upload_Matter" })

 

It sets the Id dynamically and that works great ( see below ). The problem I'm having is with cascading, because the parent combobox is also dynamic, so I don't know what the ID will be in my additional data method.  I need to be able to somehow pass the ID of the parent combobox when setting up the child.  Here is how my child combo is defined (the parent is very similar):

 

@(Html.Kendo().ComboBoxFor(o => o)
          .DataTextField("MatterNumName")
          .DataValueField("MatterNum")
          .Placeholder("Select Matter")
          .HtmlAttributes(new { id = @ViewData["ControlId"], style = "width: 100%" })  
          .Filter("contains")
          .AutoBind(true)
          .MinLength(1)
          .DataSource(source =>
          {
              source.Read(read =>
              {
                  read.Action("GetFilteredMatters", "ClientMatter")
                      .Data("onAdditionalMatterData");
              })
                  .ServerFiltering(true);
          })
)

 

I've come at this from a few angles but coming up short each time. 

1. I can set the child/parent IDs to be similar so I could just infer the parent Id from the child.  However I haven't found a way to get the child combobox Id inside the onAdditionalMatterData js function, it seems to only contain the filter data (which I also need). If there was a way to get the sending control information out of that fitler object I think it would solve my issue.

2. I thought maybe I could pass the Id along from the template view to the onAdditionalMatterData function, something like this:

 .Data("eBillReady.ClientMatterLookups.onAdditionalMatterData('parentId')");

but I'm not sure how to do that without losing the filter data which is then no longer passed, also I would obviously need the name to populate dynamically perhaps from the viewdata.

3. I think if I dynamically set "CascadeFrom", then that may cause the Id to be part of that filters object passed to onAdditionalMatterData but I didn't get anywhere with that.  Maybe setting that manually in the page load would work?

 

 

Ivan Danchev
Telerik team
 answered on 07 Dec 2016
1 answer
340 views

Hi,

 

My notification is

 @foreach (SLEmailMessage x in Model.Notifications)
                {
                    @:var
subject = '@x.Subject';
                    @:var
body = '@x.Body';
                           @: notification.show({ title: subject, message:
body }, "upload-success");
                                 }


        });

In my controller

Where @x.Body =  "Building = 101" + Environment.NewLine +
                             "Manager Name: " + "Ali Baba";

The Environment.NewLine is causing an error. How to add a "end on line" in the notification?

I tried to replace the "end on line" by the <br> tag within a paragraph and it dit not work

A quick answer will be greatly appreciated

 

 

 

 

 

Slav
Telerik team
 answered on 07 Dec 2016
1 answer
496 views

I have a DDL  (below that is not binding to my controller (also below).   The contact controller/View are part of an area.

 

Please assist.

 

Thanks in advance

 

 

Controller

public ActionResult GetCountries([DataSourceRequest] DataSourceRequest dsRequest)
{
List<DropDownListModel> result = new List<DropDownListModel>();
foreach (DataRow dr in CommonWf.getLocationByTypeId(4).Tables[0].Rows)
{
if (!string.IsNullOrEmpty(dr["Name"].ToString()))
{
DropDownListModel returnModel = new DropDownListModel();
returnModel.Name = dr["Name"].ToString();
returnModel.Value = dr["LocationId"].ToString();
result.Add(returnModel);
}
}


DataSourceResult crapData = result.ToDataSourceResult(dsRequest);
return Json(crapData, JsonRequestBehavior.AllowGet);
}

 

 

Dropdown List

 

 

@(Html.Kendo().DropDownList()
.Name("CountryId")
.DataTextField("Name")
.DataValueField("Value")
.Events(e =>
{
e.Select("onChangeCountry"); //.DataBound("onCountryBound");
})
.OptionLabel("Select Country...")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetCountries", "Contact");
})
.ServerFiltering(true);
})

)

Peter Milchev
Telerik team
 answered on 07 Dec 2016
1 answer
136 views

Trying to apply (default filter) active.
where plu.pluActive is a boolean

I have tried:

.Filter(filters => { filters.Add(plu => plu.pluActive == true); })
 
.Filter(filters => { filters.Add(plu => plu.pluActive).Equals(true); })
 
.Filter(filters => { filters.Add(plu => plu.pluActive).Equals("true"); })

They all filter out all the rows.
If I comment out:

//.Filter(filters => { filters.Add(plu => plu.pluActive == true); })

 

I get all the rows.

???

 

Dan
Top achievements
Rank 1
 answered on 05 Dec 2016
1 answer
433 views

Hi, i've a treelist with custom command, 

and i'm trying to change the button template with the databound event like the Grid

the visual result it's ok, but the event click doesn't fire, probably because i remove the k-button class.

but if leave the class the button doesn't template.

columns.Add().Command(command =>
                 {
                     command.Custom().ClassName("k-grid-EditCustom").Text(" ").Name("EditCustom").Click("editGroup");
                     command.Custom().ClassName("k-grid-DeleteCustom").Text(" ").Name("DeleteCustom").Click("deleteGroup");
 
                 }).Width(150);
 
function treeGridGroup_DataBound(e) {
     e.sender.tbody.find(".k-grid-EditCustom").removeClass("k-button")
     e.sender.tbody.find(".k-grid-EditCustom").addClass("btn btn-warning btn-outline fa fa-pencil");
 
     e.sender.tbody.find(".k-grid-DeleteCustom").removeClass("k-button")
     e.sender.tbody.find(".k-grid-DeleteCustom").addClass("btn btn-danger btn-outline fa fa-trash-o m-l-5");
 }
Kostadin
Telerik team
 answered on 05 Dec 2016
2 answers
871 views

I'm working on a Kendo UI Grid using ASP.NET MVC. We're having an issue with the grid sticking on a specific page. If the user makes their selections and the grid brings back ten pages, it displays fine. However, if the user makes navigates to page 10 and then makes another selection that only brings back 5 pages, the grid is blank, but the correct page numbers display. If the user clicks on one of the page numbers, the data displays correctly.
Here's my grid:

@(Html.Kendo().Grid<SMT.Models.SpecimenDetail>()
        .Name("SpecimenDetailGrid")
        .Columns(columns =>
        {
            columns.Bound(e => e.uniqueID).Hidden();
            columns.Bound(e => e.SampleID).Width(180).Title("Specimen ID").ClientTemplate("#= fileLinks(data) #");
            columns.Bound(e => e.contactId).Hidden();
            columns.Bound(e => e.contact_business_email).Width(120).Title("Owner Email");
            columns.Bound(e => e.contact_business_phone).Width(120).Title("Owner Phone");
        })
        .ToolBar(tools =>
                {
                    tools.Excel();
                    tools.Custom().Text("Back to Specimen Summary").HtmlAttributes(new { id = "goBack", style = "margin-left: 880px;" });
                })
        .Excel(excel => excel
            .AllPages(true)
            .FileName("SpecimenDetailGridData.xlsx")
            .Filterable(true)
            .ProxyURL(Url.Action("Excel_Export_Save", "Home"))
            )
        .Resizable(x => x.Columns(true))
        .Reorderable(x => x.Columns(true))
        .Scrollable()
        .Sortable()
        .HtmlAttributes(new { style = "height:500px;" })
        .Pageable()
        .Filterable()
        .AutoBind(false)
        .Editable(e => e.Mode(GridEditMode.InLine))
        .DataSource(datasource => datasource
            .Ajax()
                    .Model(model => {
                        model.Id(p => p.uniqueID);
                        model.Field(p => p.SampleID).Editable(false);
                        model.Field(p => p.company_business_name).Editable(false);
 
                        // disable company name on edit
                        // model.Field(p => p.company_business_name).Editable(false);
                    })
            .Read(read => read.Action("GetSpecimenDetail", "Home").Data("FillSearchParms"))
            .Update(update => update.Action("UpdateSpecimen", "Home").Data("FillUpdateParms"))
            .Destroy(destroy => destroy.Action("DeleteSpecimen", "Home"))
            .PageSize(10)
            .Events(e => { e.RequestEnd("onRequestEnd");})
            )
    )

 

Here's the call that fires off the search:

    $(document).ready(function () {
 
    $("#divSearchSpecimenDetail").attr("style", "display: none;");
 
    $("#SearchBtn").click(function (e) {
        e.preventDefault();
 
       //debugger;
        var selectedSpecimen = $('#SpecimenCategory').data("kendoDropDownList").text();
        if (selectedSpecimen == "-- Select --") {
            alert("Please select Specimen Category");
            return;
        }
 
        var selectedUnits = $('#Units').data("kendoDropDownList").text();
        if (selectedUnits == "") {
            alert("Please select Units");
            return;
        }
 
        var units = defaultDDObj("Units");
        var specimenCat = defaultDD("SpecimenCategory");
 
        $("#divSearchSpecimenDetail").attr("style", "display: block;");
       //debugger;
        var grid = $("#SpecimenDetailGrid").data("kendoGrid");
        grid.dataSource.read();
        grid.refresh();
        grid.pager.refresh();
 
        e.preventDefault();
 
        hideColumns(specimenCat);
 
        $("#searchbar").data("kendoPanelBar").collapse($("li.k-state-active"));
    })
});

Really stuck here, thanks in advance
Nathan
Top achievements
Rank 1
 answered on 05 Dec 2016
2 answers
1.1K+ views

I have a Kendo Grid that uses Ajax. I want one of my columns to be unbound and to also use a client template. One hack is to do this:

 

columns.Template(@<text>Unused</text>).Title("SomeTitle").ClientTemplate("#=myTemplateFunction(data)#");

 

However, it is definitely a hack. Is there a better way to accomplish using a client template and have an unbound column?

Bo Chulindra
Top achievements
Rank 1
 answered on 02 Dec 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?