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

Hi,

we need to bind datatables to a grid. For that we found the following example code:

http://www.telerik.com/support/code-library/binding-to-datatable-0191a594e359

This is working fine with the following exception:

We need a custom popup editor. But this requires a model we do not have because the grid is <dynamic>. What can we do?

 Best regards,

Thomas

 

Boyan Dimitrov
Telerik team
 answered on 16 Sep 2015
2 answers
1.0K+ views
@(Html.Kendo().MobileView()
    .Title("Yeni Yazı")
    .Name("TextProsess")

    .Content(@<text> 
          @model TelerikMvcApp1.Models.NewTextModel
                @using (Html.BeginForm("textadd", "Newtext"))
                {
                
                    <table border="0" cellpadding="0" cellspacing="2" style="width: 100%">
                        <tr>
                            <td style="width: 90px">
                                Yazı Adı:
                            </td>
                            <td>
                                @Html.TextBoxFor(NewTextModel => NewTextModel.Name)
                            </td>
                        </tr>
                        
                        
                        <tr>
                            <td>
                            </td>
                          
                            <td>
                            </td>
                        </tr>
                    </table>
                                   
                    <br />
                    <input type="submit" value="Kaydet" class="k-button" />
                                       
                }
            
</text>)
 
)

Dimo
Telerik team
 answered on 16 Sep 2015
1 answer
84 views

Hi,

I have a frustrating issue with fields in my model not being populated in the Update action callback in my controller.  The model:

public class CountsPerMonthModel
{
   [Editable(false)]
   public int Id { get; set; }
   public UserModel User { get; set; }
   public int January { get; set; }
   public int February { get; set; }
   public int March { get; set; }
   public int April { get; set; }
   public int May { get; set; }
   public int June { get; set; }
   public int July { get; set; }
   public int August { get; set; }
   public int September { get; set; }
   public int October { get; set; }
   public int November { get; set; }
   public int December { get; set; }
}

The User property is being correctly populated.  Integer fields January through December are not.

The callback:

[HttpPost]
public ActionResult CountsPerMonthUpdate([DataSourceRequest] DataSourceRequest request, CountsPerMonthModel model)
{
   // model has User set, but January through December are always 0
   // digging into request, the values are set correctly
}

And finally, the code for the popup template:

@model App.Models.​CountsPerMonthModel
 
<ul class="errors"></ul>
 
<div class="editor-label">
    @Html.LabelFor(m => m.​User)
</div>
 
<div class="editor-field">
    @(Html.Kendo().DropDownListFor(m => m.​User)
        .Name("​User")
        .OptionLabel("Select ​user...")
        .DataTextField("DisplayName")
        .DataValueField("UserId")
        .DataSource(source =>
        {
            source.Read(read =>
            {
                read.Action("Get​Users", "Management", new { includeReadOnly = false });
            });
        })
    )
</div>
 
<div>
    <p>@Html.Label("​Counts Per Month")</p>
</div>
 
<div class="editor-label">
    @Html.LabelFor(m => m.January)
</div>
 
<div class="editor-field">
    @Html.EditorFor(m => m.January)
    @Html.ValidationMessageFor(m => m.January)
</div>
 
<div class="editor-label">
    @Html.LabelFor(m => m.February)
</div>
 
... snipped for brevity ...
 
<div class="editor-field">
    @Html.EditorFor(m => m.February)
    @Html.ValidationMessageFor(m => m.February)
</div>
 
<
<div class="editor-label">
    @Html.LabelFor(m => m.December)
</div>
 
<div class="editor-field">
    @Html.EditorFor(m => m.December)
    @Html.ValidationMessageFor(m => m.December)
</div>
 
@Html.HiddenFor(m => m.Id)

When given a populated model, the values are displayed correctly in each field, it is only when Update is clicked, any updated values in the fields are not populated into the model object in the callback.

Any thoughts on what the issue might be?  I've used similar code in other places, this is the first time though that any fields have been an int type, so am wondering if I'm missing something somewhere...

Also, the editor template for Integer is as follows:

@model int?
 
@(Html.Kendo().IntegerTextBoxFor(m => m)
      .HtmlAttributes(new { style = "width:100%" })
      .Min(int.MinValue)
      .Max(int.MaxValue)
)

 

Thanks,

Craig.

 

Rosen
Telerik team
 answered on 16 Sep 2015
3 answers
277 views

I have a DataSet that I'm generating on the fly.

I'm doing this by collecting all of my data and then building a DataTable and then using the DataTable as a DataSource for my Kendo Grid.

The Grid is set up to use AutoGenerated columns, like this ...

@(Html.Kendo().Grid(Model.Data)
  .Name("grid")
  .Columns(c =>
  {
    c.AutoGenerate(true);
  }
  .Scrollable()
  .Resizable(a =>
  {
    a.Columns(true);
  })
)

I want to freeze the first column in this Grid (I will always know what this column is).

I haven't found a way of manipulating the Columns at all when using AutoGenerated columns and have had to resort to a number of jQuery/CSS 'fudges' to get the Grid looking and behaving the way that I want it to.

However, I'm at a loss as to how I might be able to freeze a column when the Grid uses AutoGenerated columns.

Is is actually possible?

If it is, would you care to give me a hint as to how I might go about it?

Stuart
Top achievements
Rank 1
 answered on 16 Sep 2015
1 answer
198 views

Hello,

sometimes when I try to Upload files via the upload-control the upload ends up in 103% without the save and onsuccess-events firing. It doesn't seem to have anything to do with the file itself, as I'm always using the same. Sometimes it works, sometimes it doesn't.

function onSuccess(e) {
    var gridNotification = $("#gridNotification").data("kendoNotification");
    var crmType = $("#ddlCrmType").data("kendoDropDownList");
    var csvHeadRow = e.response.csvHeadRow
    var url = '@Url.Action(MVC.Mapping.ReturnMappingGrid())';
    $.ajax({
        type: "POST",
        url: url,
        data: JSON.stringify({ csvHead: csvHeadRow, crmType: crmType.text() }),
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (data) {
            $('#gridContainer').html(data);
            gridNotification.show("Die Auswahl der jeweiligen Eigenschaft erfolgt durch Klicken des jeweiligen Eigenschaft-Felds!")
            var container = $(gridNotification.options.appendTo);
 
        },
        error: function (xmlHttpRequest, textStatus, errorThrown) {
            debugger;
            console.log(xmlHttpRequest.responseText);
            console.log(textStatus);
            console.log(errorThrown);
        },
        async: false
    });
}

@(Html.Kendo().Upload()
    .Name("upMappingFile")
    .Multiple(false)
    .ShowFileList(true)
    .TemplateId("fuCsvTemplate")
    .Async(a => a
        .AutoUpload(true)
        .Save("SaveFile", "Mapping")
        .Remove("RemoveFile", "Mapping")
    )
    .Enable(false)
    .Events(e => e
        .Success("onSuccess"))
    .Messages(m => m
        .Select("Durchsuchen...")
        .HeaderStatusUploading("Uploading...")
        .HeaderStatusUploaded("Fertig"))
)

Dimo
Telerik team
 answered on 16 Sep 2015
3 answers
137 views
I have a problem with Gantt chart. Our application is deployed on a server with its timezone set to UTC. I'm hitting the application from US Pacific timezone, and when I update or add new task, the data submitted to the server is in UTC as oppose to my local time. So when I open Task edit form and set a Start time of 9/8/2015 12:00:00 AM (which should be Pacific, since my browser is in pacific), the data being posted to server shows it as 9/8/2015 12:00:00 AM UTC. How can I overcome this?
Bozhidar
Telerik team
 answered on 16 Sep 2015
1 answer
751 views

I've following code in razor view. How do I use Kendo Radio button to render the same? I'm struggling to assign enum to radio button value.

@if (Model == declaredEnum.​Val1) //declaredEnum is Enum
{
    @Html.RadioButtonFor(l => l, (int)declaredEnum.​Val1, new { @checked = "checked" });
    
}
else
{
    @Html.RadioButtonFor(l => l, (int)declaredEnum.​Val1);   
}
@Html.LabelFor(l => l, "Label")​

Daniel
Telerik team
 answered on 16 Sep 2015
4 answers
2.9K+ views

Hi,

I am facing problem while using kendo dropdownlist with kendo grid. I have a kendo grid with all the fields as dropdown (around 12 fields) except one column(employeename) as a simple display column. For dropdown fields, I have created partial views as EditorTemplates and attached them to the grid column. But when I run my application, initially it does not display the dropdowns. When click the cell turns into a dropdown field and when I select any value and change focus, the grid cell gets populated with dropdown value property and not the text property. For some of the columns, it even does not set the selected value in cell. No idea what is the issue. below is my code:

@(Html.Kendo().Grid(Model)
            .Name("EmployeeHarborGrid")
            .EnableCustomBinding(false)
            .Columns(columns =>
              {
                    columns.Bound(d => d.EmployeeName).Title("Employee");
                    columns.Bound(d => d.AcaJobClassification).Title("ACA Job Classification")
                               .EditorTemplateName("_AcaJobClassification").Width(120).ClientTemplate("#:AcaJobClassification#");
                    columns.Bound(d => d.TwelveMonthsOffer).Title("12 Months Offer")

              }

 

my editor template code:

@using Kendo.Mvc.UI
@(Html.Kendo().DropDownListFor(m => m)
.Name("AcaJobClassification").HtmlAttributes(new { @style = "font-size:12px" })
.DataTextField("Text")
.DataValueField("Value")
.BindTo(new List<SelectListItem>()
{
new SelectListItem() {Text="--Please Select--", Value="0"},
new SelectListItem() {Text="Contract", Value="1"},
new SelectListItem() {Text="Educator", Value="2"},
new SelectListItem() {Text="Fulltime", Value="3"},
new SelectListItem() {Text="Parttime", Value="4"},
})
.SelectedIndex(3)
)

 

If employee record exists, then I want the dropdowns to pick the record value and set the dropdown index accordingly.

Can I achieve this with ClientTemplate attribute on the column. I would prefer using ClientTemplate instead of creating EditorTemplate. Please suggest. Also, I want to bind this dropdown with an Enum list but facing problem with that as well. Can you help me out with that as well?

Appreciate your quick reply. 

Thanks.

 

Alexander Popov
Telerik team
 answered on 16 Sep 2015
1 answer
118 views

Hello All,

               I have attached the screenshot for better understanding.

I have a control in classic asp technology which behaves like tree in left panel and in the right panel it behaves like a Excelsheet

where a user can work as he is working as a excel person.

I want to know the similiar control which is useful for me to make the same functionality as this attached file is showing it.

please kindly let me know .

Shaikh
Top achievements
Rank 1
 answered on 16 Sep 2015
2 answers
124 views

Hi,  

I'm trying to customize the filter of a column of date type. By default the filter UI of date type is is an operator type of equal/before/after with a datepicker. But I want the filter to be more powerful. I want to filter by specific date or by number. If it is by date then it is no difference with the default filter. But if it is filtered by numbers (days and hours), I hope it can be filtered by the difference of days and hours between now and the date value in database. 

The server side is implemented with ASP.NET WEB API with odata. It seems obvious that the filter parameter passed to the server side should be converted to a date on the client when filtering by day and hour number. To distinguish the filter type between date and day/hour number, I think a switcher is also needed on the UI. 

I'd like to know, if this kind of filter customization (a standard UI with an extra filter type switcher, days and hours textbox ) is possible? Is there an api giving me the chance to convert the numbers to a date before submitting for server side filtering?

Thank you for your help!

Paddy
Top achievements
Rank 1
 answered on 16 Sep 2015
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
Upload
ComboBox
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
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
ListView (Mobile)
Pager
Accessibility
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
MediaPlayer
TileLayout
DateInput
Drawer
SplitView
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Template
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
Licensing
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
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?