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

I hate bringing this up, because DST can be such a mind #$%$. But here we go: 

I have declared a Kendo datetimepicker like so:

 

@(Html.Kendo().DateTimePicker()
.Name("StartDatePicker")
.Format("yyyy/MM/dd HH:mm zzz")
.TimeFormat("HH:mm")
)​

 

I'll be using MST as my example timezone, ie. -6:00 or -7:00. On November 1st @ 2:00 AM time goes backwards 1 hour. So basically the time one second after 1:59:59 AM (-06:00) becomes 1:00:00 AM (-07:00)

The KendoDateTimePicker seems to be smart enough to recognize the timezone change. For example, selecting November 1st 00:30 (pre-time change) will show a timezone of (-06:00), and selecting November 1st 02:00 (post time change) will show a timezone of (-07:00)

The tricky part with the November time change is that there are two occurrences of 01:00:00 - 01:59:59 during that day. The first occurrence has a timezone of -06:00 and the second has a timezone one less, of -07:00. So the question is, how do I select one occurrence or the other, without having to manually input the timezone?

The expectation is that the clients current timezone is used. So if the current local time is before the time change (-06:00), then if I select November 1st 01:30 I expect the timezone to be (-06:00). If the current local time is after the time change (-07:00), then if I select November 1st 01:30 I expect the timezone to be (-07:00).

 At the moment the KendoDateTimePicker doesn't match those expectations, and instead defaults to the pre-time change timezone of (-06:00) regardless of what the timezone of the web server or the client is. It is therefore impossible to select time between 01:00:00 - 01:59:59 (-07:00).

Is this a bug or is there someway of making the datetimepicker aware of the client's current timezone?

Georgi Krustev
Telerik team
 answered on 18 Sep 2015
1 answer
149 views

I have a search form which will get a list of records.
I would like to bind the search results on pressing submit after performing some initial ​checks on the entered data. How do i bind my action result to the Kendo Grid ?
 My JS File is 
function validateDataForSearch() {
        var empNo = $("#empNo").val();
        var empName = $("#empName").val();
        var empMgr = $("#empMgr").val();
        var clientName = $("#ClientName").val();

        var noValues = empNo.length + empName.length + empMgr.length + clientName.length;

        if (noValues <= 0) {
            alert("Please enter at least one value to be able to search.");
        }
        else {
            if (empNo.length <= 0)
                empNo = 0;
            $.ajax({
                type: "POST",
                url: 'Home/Search',
                data: { empNo: empNo, empName: empName, empMgr: empMgr, clientName: clientName },
                success: function (response) {                
                        $("#pmtSearchResult").getKendoGrid().dataSource.data(response);
                        }
            });
        }​;

 

  function get​EmpLink(project) {
        var action = '@Url.Action("Index","PMP", new { ​emp= '+ ​emp +')';
        var ​empLink = kendo.format("<a href='{0}'>{2}</a>", action, ​emp.empNo);
        return empLink;
    }

 var validator = $("#searchForm").kendoValidator().data("kendoValidator");

    $("#btnSearch").click(function (e) {        
        if (!validator.validate()) {
            e.preventDefault();
        }
        else
            validateDataForSearch();
    });

 

 

 

My CSHTML is as follows

@model IEnumerable<PMT.Models.EmpData> 
<div id="kendoGrid">
    @(Html.Kendo().Grid(Model)
    .Name("SearchResult")
    .Columns(columns =>
    {
        columns.Bound(p => p.empNo).ClientTemplate("#= getEmpLink(data) #");
        columns.Bound(p => p.empName);
        columns.Bound(p => p.empMgr);
        columns.Bound(p => p.ClientName);

        columns.Bound(p => p.empSal).hidden(true);

    })
    .Pageable()
    .Sortable()
    .Scrollable(scr => scr.Height(430))
    .Filterable()
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(20)
        .ServerOperation(false)
     )
    )​

 

I cant seem to render the grid to hide the empSal column or to show  the emloyeeid column as a hyperlink column

Rosen
Telerik team
 answered on 17 Sep 2015
1 answer
166 views

 Please find the below code as i want to set default value of dropdown instead of optionlable from  JSON data which is returned from controller .

Please find the below code

 

 

@(Html.Kendo().DropDownList()
              .Name("DropDownList1")
                                       
              .HtmlAttributes(new { style = "width:300px" })
              .OptionLabel("Select ...")
              .DataTextField("District_Id")
              .DataValueField("Location_ID")
            
             
                      .DataSource(source =>
           {
               source.Read(read =>
                  {
                      read.Action("GetOrders", "IDTDashboard");
                  })
                  .ServerFiltering(true);
           })
           .AutoBind(false)

 

public ActionResult GetOrders()
       {
           List<usp_IDQ_GetLicenseDistrictsVO> objresult1 = new List<usp_IDQ_GetLicenseDistrictsVO>();
           objresult1 = objConnection.usp_IDQ_GetLicenseDistricts(User.Identity.Name, true).ToList();
           return Json(objresult1, JsonRequestBehavior.AllowGet); ;
       }

Georgi Krustev
Telerik team
 answered on 17 Sep 2015
1 answer
239 views

Hi,

We have a combobox and a button inside a form (all HTML helper) and when we submit (its just a search form) two querystring items are appended to the forms destination - one with the name of the "Combobox" giving the value and one with "ComboBox_input" giving the text.

We're using a combobox so we can have the Text and the Value separate.

How can we stop both the Text AND Value being added as a querystring value?

I know we can do an on change event and window.location, but we've a requirement for an actual button to click and I thought this would work ...

01.@using (Html.BeginForm("Details", "Property", FormMethod.Get))
02.    {
03.     
04.    @(Html.Kendo().ComboBox()
05.    .Name("PropertyId")
06.    .DataTextField("Searchable")
07.    .DataValueField("PropertyRef")
08.    .Placeholder("Search for property by ref or name ...")
09.    .Filter(FilterType.Contains)
10.    .AutoBind(false)
11.    .MinLength(4)
12.    .DataSource(source =>
13.    {
14.        source.Read(read =>
15.        {
16.            read.Action("PropertySearch_Read", "Search");           
17.        })
18.    .ServerFiltering(false);
19.    })
20.   .HtmlAttributes(new { style = "width:100%" })
21.    )
22. 
23. 
24.    @(Html.Kendo().Button()
25.        .Name("btnSubmit")
26.        .HtmlAttributes(new { type = "submit" })
27.        .Content("Search")
28.    )
29.}

Thanks,

Daniel

Georgi Krustev
Telerik team
 answered on 17 Sep 2015
1 answer
542 views

I have the following grid

<div class="actualGrid" id="actualGrid">
        @(Html.Kendo().Grid<AVNO_KPMG.Models.Bench>()
            .Name("grid")
 
        .Columns(columns =>
        {
            columns.Bound(p => p.name).Title("Bench").Filterable(ftb => ftb.Cell(cell => cell.Operator("contains"))).Width(125);
            columns.Bound(p => p.freeSeats).Title("Free Seats").Width(350);
 
            columns.Command(command => { command.Custom("checkBench1 ").Text(" AM ").Click("doCheckIn"); command.Custom("checkBench 2").Text(" PM ").Click("doCheckIn"); command.Custom("checkBench3").Text("All Day").Click("doCheckIn"); }).Width(250).Title("Check in");
 
        })
 
 
        //.Editable(editable => editable.Mode(GridEditMode.PopUp))
        .Pageable()
        .Sortable()
 
        .Scrollable()
                .Filterable(ftb => ftb.Mode(GridFilterMode.Row))
        .HtmlAttributes(new { style = "height:530px;" })
                .Events(events => events.DataBound("onDataBound"))
        .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(20)
        .Events(events => events.Error("error_handler"))
        .Model(model => model.Id(p => p.id))
                        .Read(read => read.Action("GetBenches", "Home"))
 
 
                )
        )
    </div>

 I would like to know if there is a way to change the size of the grid according to the number of results i have when i use filter

for Example if i filter first column and get 1 result grid would be small, and if i had 10 results i would be larger.

Radoslav
Telerik team
 answered on 17 Sep 2015
1 answer
152 views

Hello,

 

Could you please let me know how one can control the placement of the slider tooltip? By default it is to bottom and the ask is to have it placed above.

 

Thanks!

Petyo
Telerik team
 answered on 17 Sep 2015
4 answers
144 views

Hello, I'm currently evaluating the MVC controls. I've created a custom control panel where the user can filter  or create new items on the table.  Currently the filter is working perfectly using javascript. The create button is not.  I added the class k-grid-add but no luck. I look at the link the grid creates when using the standard create button in the toolbar and it looks something like this: tblAgents_Read?grid-mode=insert  . I've tried adding this link to my custom link but it will return all data in a json file.  Any help?

 

MiracleMan
Top achievements
Rank 1
 answered on 17 Sep 2015
1 answer
226 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
97 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
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
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?