Telerik Forums
UI for ASP.NET MVC Forum
1 answer
167 views
In the Kendo Grid below, I set the page size attribute to five - PageSize(5)

However, after inserting the 6th & 7th records, clicking  the 'Next' arrow doesn't take me to the second page.
In fact, none of the Paging buttons work - i don't have the ability to page through my data. Can you help?

I'm not reading data from a database - I just want to insert records into the grid that gets saved into a
temporary Dictionary<string, bool> variable and see if the paging works.

@(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.ProductViewModel>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.ProductName);
columns.Bound(p => p.Discontinued);
columns.Command(command => { command.Edit(); command.Destroy(); }).Width(172);
})
.ToolBar(toolbar => toolbar.Create())
.Editable(editable => editable.Mode(GridEditMode.InLine))
.Pageable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(5)
.Events(events => events.Error("error_handler"))
.Model(model => model.Id(p => p.ProductID))
.Create(update => update.Action("EditingInline_Create", "Grid"))
.Update(update => update.Action("EditingInline_Update", "Grid"))
.Destroy(update => update.Action("EditingInline_Destroy", "Grid"))
)
)
Vladimir Iliev
Telerik team
 answered on 08 Oct 2013
1 answer
8.5K+ views
Hi,

I use Kendo UI ASP.NET MVC with VB.NET and jquery for client validation. My question is:
How I can format the date into ‘dd.mm.yyyy’. I also want to use the @Html.EditorFor() and the client validation.

Setting up the Model:

<DataType(DataType.[Date],
ErrorMessage:="Datumsformat ungültig")>
<DisplayFormat([ApplyFormatInEditMode]:=True,
[DataFormatString]:="{0:dd.MM.yyyy}")>_
Public Property Geburtstag As Nullable(Of DateTime)


Setting up the View:

         <td class="editor-label" style="width: 100px">
            @Html.LabelFor(Function(model) model.Geburtstag)
        </td>
        <td class="editor-field">
            @Html.EditorFor(Function(model) model.Geburtstag)
            @Html.ValidationMessageFor(Function(model) model.Geburtstag)
        </td>

 The client validation doesn’t accept the format ‘dd.MM.yyyy’ only the ‘dd/MM/yyyy’ format.

How I can overwrite the client validation for the date format?

I suppose the validation is in a jquery file.

Thanks for help







Alexander Popov
Telerik team
 answered on 08 Oct 2013
3 answers
71 views
Hi, 

We stumbled upon a limitation of the grid and we'd like to suggest a fix.

The problem has to do with the grid and a custom field inside of it in inline editing grid (I haven't tested cell editing, but it's most likely the same). If we use, say, a DropDownList editor, the initial value will not be set. 

The issue is that if we have a dropdownlist with an initial value, the user could leave it at that and submit the row. However, since the initial value was never changed, we'd be getting a "null" instead. 

Our solution was to trigger the "change" event on the dropdown, which was enough to update the value into the grid's datasource.

I feel like this is unclear, so here's a jsfiddle : http://jsfiddle.net/jni_/3G7FK/
In the editor, I added a "see value" link that reads from the grid datasource. Add an item and click on it. You'll see that it alerts a 0. Change to value, and you'll be set. In edition mode, this is not a problem  either. 

Simply firing an initial "change" event will force the initial value to be taken into account. 

Thanks,
Jni

PS : I'm sorry - I didn't realize there was a "grid" forum separate from the asp.net mvc grid. Can you please move it?
Petur Subev
Telerik team
 answered on 08 Oct 2013
1 answer
119 views
I have a simple Kendo grid with inline editing capabilities that I want to tie to a Pie chart.
Basically, when I update the value of a certain row[column] in the grid, I want the Pie chart
to reflect the change and redraw immediately. How can I do that?

The data for the grid is saved to a List<ProductViewModel>. 
Alexander Popov
Telerik team
 answered on 07 Oct 2013
1 answer
140 views
Good morning.
I have a question.
What will be the approach to use the tab strip in order to programitally create the tabs and inside them have custom urls that are also set on the server side.
Right now  my controller is returning a tab object that contains the information
 public class Tab
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public string Url { get; set; }
        public bool Visible
        {
            get;
            set;
        }

        public string UserName{ get; set; }

        public Tab()
        {
            Visible = true;
        }
    }


@model List<Tab>
@(Html.Kendo().TabStrip()
    .Name("tabstrip") 
    .BindTo(Model,(item,category)  =>
    {
        item.Text = category.Name;
    })
    
So how do i map the content url of the tabs. I say content because the html is retrieved as the user clicks on the tabsand not all at once.

    
Daniel
Telerik team
 answered on 07 Oct 2013
1 answer
157 views
Hi Team,

We are having issues on Html.Kendo().TabStrip(). We are not able to pass our model to Html.Kendo().TabStrip(). There two issues on this.
1. If i have partial view which is called in the TabStrip. If i have the data in the model still i am not able to pass it to the partial view.
2. If i get the data in my partial view in the HttpPost the model data is becoming null.

Sample code.

Main View

 @(Html.Kendo().TabStrip()
              .Name("assetTabStrip")
              .Items(assetTabStrip => assetTabStrip.Add().Text("Field Criteria")
                  .Selected(true)
                  .LoadContentFrom("EditFieldCriteria", "Asset", new { GroupID = Model.GroupID }))
              .Items(assetTabStrip => assetTabStrip.Add().Text("Sort Criteria")
                  .LoadContentFrom("EditSortCriteria", "Asset", new { GroupID = Model.GroupID }))

              .Animation(false)

              )

Partial view

@model Sage.FA.SFAO.WebSite.Models.Asset.GroupModel
@using EnumHtmlHelper.Helper
@{
    ViewBag.Title = "EditFieldCriteria";
}

<table>
    <tr>
        <td align="left">@Html.Label("Look In:")</td>
        <td align="left">@Html.Label("Select an Operator:")</td>
        <td align="left">
            @Html.Label("Find What:")
        </td>
    </tr>
    
     @foreach (var item in Model.Criteria) {
         if (item.LookIn != 0 && item.Operator != 0 && item.Value != null)
         
                {
                      <tr>
                          <td>
                              @Html.EnumDropDownListFor(modelitem => item.LookIn)

                          </td>
                          <td>
                              @Html.EnumDropDownListFor(modelitem => item.Operator)
                          </td>
                          <td>
                            @Html.TextBoxFor(modelitem => item.Value, new { @class = "k-textbox", @id = "expenseGL" })
                          </td>
                    </tr>      
                 }
             }
                   
  

</table>

My Post method
[HttpPost]
        public ActionResult EditGroup(GroupModel groupModel, FormCollection formCollection)

groupModel.Criteria became null.

Please help.



Daniel
Telerik team
 answered on 07 Oct 2013
1 answer
223 views
Hi all
Due to technical reason we have to fully postback our ASP.NET MVC view. This view contains a Kendo TreeView which will be loaded and bound in the view to the model as follow:
@(Html.Kendo().TreeView()
          .Name("EditMenu")
          .DragAndDrop(true)
          .BindTo(ourModel)
      )
ourModel is:
List<Kendo.Mvc.UI.TreeViewItemModel>
It seems that there is no property 'selected' in this TreeViewItemModel class. So my question is: Is it possible to select a TreeView Node on server side? If not what would be a good solution to preserver selected Node during postback?

Thanks for help
Adrian

Daniel
Telerik team
 answered on 07 Oct 2013
4 answers
2.2K+ views
It has been a while since I've used any Telerik/Kendo controls.  I have a Contact Us form from which I'd like to pop up a Thank You window on a successful submit.  The form submits to the Controller which validates the input and sends an email and if all is successful, I return a partial view which should be the pop up.  However, this partial view is showing in the main browser window and I'm getting the $ not defined error.  I am obviously missing something, but I'm rusty and in a hurry and can't quite figure out what it is...  Any help is very much appreciated!

Thank you,
Donna

Here's the Contact Us page code:
@model GMCWeb.Models.ContactViewModel
 
@{
    Layout = "~/Views/Shared/_PublicLayout.cshtml";
}
<div id="page">
    <div class="contact-page hero-unit">
        <div class="container">
            <h1>Contact</h1>
        </div>
        <!--close container-->
    </div>
    <!--close hero-unit-->
     
    <div class="container clearfix" id="main-content">
        <div class="row-fluid reverse-order contact-page">
            <h3 class="clearfix"> Green Mountain Consulting's Parcel Spend Management solution gives you more for your money.  Contact us today to find out how to start saving more. </h3>
            <hr />
            <div class="span7">
                <div class="row-fluid">
                    <div class="span6 ">
                        <p><span class="company-name"><strong>Green Mountain Consulting</strong></span><br />
                            7240 Goodlett Farms Pkwy<br />
                            Memphis, TN 38016<br />
                            <strong>phone (toll free):</strong> <a href="tel:8773972834 " class="tele">877.397.2834</a><br />
                            <strong>phone (local):</strong> <a href="tel:9015079307 " class="tele">901.507.9307</a><br />
                            <strong>fax:</strong> 901.507.9329<br />
                            <strong>email:</strong><span class="gmcgreenlink"><a href="mailto:info@greenmountainconsulting.com">info@greenmountainconsulting.com</a></span></p>
                        <!--close input-append-->
                    </div>
                    <div class="span6 contact-map">
                        <p class="right">
                            <iframe width="320" height="250" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?f=q&;source=s_q&hl=en&geocode=&q=Green+Mountain+Consulting,+LLC,+Goodlett+Farms+Parkway,+Memphis,+TN&aq=0&oq=GREEN+MOUNTAIN+CONSULTING&sll=35.05842,-89.692315&sspn=0.247027,0.528374&ie=UTF8&hq=Green+Mountain+Consulting,+LLC,&hnear=Goodlett+Farms+Pkwy,+Memphis,+Shelby,+Tennessee&t=m&ll=35.180403,-89.822502&spn=0.035077,0.05476&z=13&iwloc=A&output=embed"></iframe><br /><small><a href="https://maps.google.com/maps?f=q&;source=embed&hl=en&geocode=&q=Green+Mountain+Consulting,+LLC,+Goodlett+Farms+Parkway,+Memphis,+TN&aq=0&oq=GREEN+MOUNTAIN+CONSULTING&sll=35.05842,-89.692315&sspn=0.247027,0.528374&ie=UTF8&hq=Green+Mountain+Consulting,+LLC,&hnear=Goodlett+Farms+Pkwy,+Memphis,+Shelby,+Tennessee&t=m&ll=35.180403,-89.822502&spn=0.035077,0.05476&z=13&iwloc=A" style="color:#0000FF;text-align:left">View Larger Map</a></small>
                        
                        </p>
                    </div>
                </div>
                <h3 class="short_headline margin-top"><span>Your Area Sales Representative</span></h3>
                <div class="row-fluid salesrep-div">
                    @{Html.RenderAction("getAllSalesReps");}
                </div>
            </div>
            <!--close span5 -->
             
            <div class="span5 form-horizontal">
                @using(Html.BeginForm()) {
                    @Html.ValidationSummary(true)
                    <fieldset>
                        <legend>Contact GMC</legend>
                        <div class="control-group">
                            @Html.LabelFor(model => model.Name)
                            @Html.TextBoxFor(model => model.Name)
                            <p class="error">@Html.ValidationMessageFor(model => model.Name)</p>
                        </div>
                        <div class="control-group">
                            @Html.LabelFor(model => model.Phone)
                            @Html.TextBoxFor(model => model.Phone)
                            <p class="error">@Html.ValidationMessageFor(model => model.Phone)</p>
                        </div>
                        <div class="control-group">
                            @Html.LabelFor(model => model.Email)
                            @Html.TextBoxFor(model => model.Email)
                            <p class="error">@Html.ValidationMessageFor(model => model.Email)</p>
                        </div>
                        <div class="control-group">
                            @Html.LabelFor(model => model.Message)
                            @Html.TextAreaFor(model => model.Message)
                            <p class="error">@Html.ValidationMessageFor(model => model.Message)</p>
                        </div>
                        <button type="submit" class="btn btn-primary btn-large">Send</button>
                    </fieldset>
                    <div class="control-group">
                        @foreach (var item in ViewData.ModelState)
                        {
                            if (item.Value.Errors.Any())
                            {
                                foreach (ModelError e in item.Value.Errors)
                                {
                                    <p class="error">@e.ErrorMessage</p>
                                }
                            }
                        }
                    </div>
                }
            </div>
            <!--close span7 -->
        </div>
        <!--close row-fluid-->
    </div>
    <!--close .container role="main-content" -->
</div>
Here's the partial view for the popup:
@(Html.Kendo().Window()
    .Name("ContactConfirmWindow")
    .Title("Thank you for contacting us.")
    .Content(@<text>
            <div class="pull-left">
                <img src="@Url.Content("~/Content/images/3dwhitebusinessmanthankyou.png")" alt="Thank You!" />
            </div>
            <h3>We appreciate your interest in our company. We wil be in touch with you soon.</h3>
        </text>
    )
    .Iframe(true)
    .Draggable()
    .Resizable()
    .Width(400)
    .Actions(actions => actions.Minimize().Maximize().Close())
    .Deferred()
  )
 
<script type="text/javascript">
    $(document).ready(function () {
        $("#ContactConfirmWindow").data("kendoWindow").open();
    });
</script>
And here's the controller action:
[HttpPost]
public ActionResult Contact(ContactViewModel contactVM)
{
    if (!ModelState.IsValid)
    {
        return View(contactVM);
    }
 
    var contact = new Contact()
    {
        Name = contactVM.Name,
        Email = contactVM.Email,
        Phone = contactVM.Phone,
        Message = contactVM.Message
    };
 
    try
    {
        new Email().Send(contact);
    }
    catch(Exception ex)
    {
        ModelState.AddModelError("EmailException", "Oops!  We are sorry, but there was a problem sending your request.  We will fix this as soon as possible.  Please try again later.");
        Console.Write(ex.Message);
        return View(contactVM);
    }
    return PartialView("ContactConfirm");
}

Donna Stewart
Top achievements
Rank 1
 answered on 04 Oct 2013
2 answers
576 views
I have a grid that I am using to manage outlook contacts. This data grid is using inline editing to make edits to the contacts. I also have a button on the page that reads the contacts from the database and checks for address errors. The issue is that the update does not propagate to the database until I force a browser refresh. The goal is to make changes then check the contact addresses without having to leave the page or force a browser refresh.

01.   
02.<div class="SectionBoxCorners" style="width: 1610px;height:760px;position: absolute;top: 180px;left:35px">
03.    <div class="SectionBoxGradient" style="width: 1610px;height:725px; padding: 10px;padding-right: 20px">
04.        @(Html.Kendo().Grid<OutlookContact>()   
05.              .Name("outlookContacts")   
06.              .Columns(columns =>
07.                  {
08.                      columns.Command(command => { command.Edit(); command.Destroy(); }).Width(160);
09.                      columns.Bound(p => p.FirstName).Width(100);
10.                      columns.Bound(p => p.LastName).Width(125);
11.                      columns.Bound(p => p.Suffix).Width(75);
12.                      columns.Bound(p => p.Company).Width(150);
13.                      columns.Bound(p => p.Department).Width(100);
14.                      columns.Bound(p => p.JobTitle).Width(100);
15.                      columns.Bound(p => p.BusinessStreet).Title("Bus. Street").Width(150);
16.                      columns.Bound(p => p.BusinessStreet2).Title("Bus. Street 2").Width(150);
17.                      columns.Bound(p => p.BusinessCity).Width(125);
18.                      columns.Bound(p => p.BusinessState).Title("Bus. State").Width(100);
19.                      columns.Bound(p => p.BusinessPostalCode).Title("Bus. Zip").Width(75);
20.                      columns.Bound(p => p.HomeStreet).Width(150);
21.                      columns.Bound(p => p.HomeStreet2).Width(150);
22.                      columns.Bound(p => p.HomeCity).Width(100);
23.                      columns.Bound(p => p.HomeState).Title("Home State").Width(100);
24.                      columns.Bound(p => p.HomePostalCode).Title("Home Zip").Width(100);
25.                      columns.Bound(p => p.AssistantsPhone).Width(150);
26.                      columns.Bound(p => p.BusinessFax).Title("Bus. Fax").Width(125);
27.                      columns.Bound(p => p.BusinessPhone).Title("Bus. Phone").Width(125);
28.                      columns.Bound(p => p.BusinessPhone2).Title("Bus. Phone 2").Width(125);
29.                      columns.Bound(p => p.HomePhone).Width(125);
30.                      columns.Bound(p => p.HomePhone2).Width(125);
31.                      columns.Bound(p => p.MobilePhone).Width(125);
32.                      columns.Bound(p => p.OtherFax).Width(125);
33.                      columns.Bound(p => p.OtherPhone).Width(125);
34.                      columns.Bound(p => p.PrimaryPhone).Width(125);
35.                      columns.Bound(p => p.Telex).Width(100);
36.                      columns.Bound(p => p.Account).Width(100);
37.                      columns.Bound(p => p.Anniversary).Format("{0:MM/dd/yyyy}").Width(100);
38.                      columns.Bound(p => p.AssistantsName).Width(125);
39.                      columns.Bound(p => p.BillingInformation).Width(200);
40.                      columns.Bound(p => p.Birthday).Format("{0:MM/dd/yyyy}").Width(100);
41.                      columns.Bound(p => p.Categories).Width(200);
42.                      columns.Bound(p => p.EmailAddress).Width(200);
43.                      columns.Bound(p => p.EmailDisplayName).Width(250);
44.                      columns.Bound(p => p.Email2Address).Width(200);
45.                      columns.Bound(p => p.Email2DisplayName).Width(250);
46.                      columns.Bound(p => p.Email3Address).Width(200);
47.                      columns.Bound(p => p.Email3DisplayName).Width(250);
48.                      columns.Bound(p => p.Gender).Width(100);
49.                      columns.Bound(p => p.Initials).Title("Init.").Width(50);
50.                      columns.Bound(p => p.ManagersName).Title("Manager").Width(100);
51.                      columns.Bound(p => p.Mileage);
52.                      columns.Bound(p => p.Notes).Width(250);
53.                      columns.Bound(p => p.OfficeLocation);
54.                      columns.Bound(p => p.OrganizationalIdNumber).Title("Org. ID").Width(75);
55.                      columns.Bound(p => p.Spouse).Width(100);
56.                      columns.Bound(p => p.User1);
57.                      columns.Bound(p => p.WebPage).Width(200);
58.                  })
59.              .ToolBar(toolbar => toolbar.Create())
60.              .Editable(editable => editable.Mode(GridEditMode.InLine))
61.              .Filterable()
62.              .Pageable()
63.              .Sortable()
64.              .Scrollable()
65.              .HtmlAttributes(new { style = "height:675px; td height:50px;" })
66.              .Resizable(resize => resize.Columns(true))
67.              .DataSource(dataSource => dataSource
68.                                            .Ajax()
69.                                            .AutoSync(true)
70.                                            .PageSize(100)
71.                                            .Model(model=> model.Id(p=> p.OutlookContactId))
72.                                            .Create(update=> update.Action("AddOutlookContact", "Options"))
73.                                            .Update(update=> update.Action("UpdateOutlookContact", "Options"))
74.                                            .Destroy(update=> update.Action("DeleteOutlookContact", "Options"))
75.                                            .Read(read => read.Action("GetOutLookContacts", "Options"))
76.              ))
77.        </div>
78.</div>
01.@(Html.Kendo().Window()
02.    .Name("window")
03.    .Title("Contact Address Errors")
04.    .Content("loading  info...")
05.    .LoadContentFrom("CheckContacts", "Options")
06.    .Iframe(false)
07.    .Draggable()
08.    .Resizable()
09.    .Height(350)
10.    .Width(350)
11.)
12. 
13.<script>
14.    $(document).ready(function () {
15.        $("#window").data("kendoWindow").close();
16.        $("#CheckContacts")
17.            .bind("click", function () {
18.                var grid = $("#outlookContacts").data("kendoGrid");
19.                //grid.datasource.saveChanges();
20.                grid.dataSource.sync();
21.                grid.dataSource.read();
22.                $("#window").data("kendoWindow").center();
23.                $("#window").data("kendoWindow").open();
24.            });
25.    });
26.</script>
Gordon
Top achievements
Rank 2
 answered on 04 Oct 2013
1 answer
1.0K+ views
Hi again, 

We can't seem to add a class to a custom command. We tried to following : 

columns.Command(Sub(command)
    command.Custom("btnSupprimer").Text(" ").Click("supprimerReaction").HtmlAttributes(new With { .class = "potatoes" })
End Sub)

The class is not added anywhere. Is there a way to fix this? We can't really add it in jQuery, since the row keeps being update (it has inline editing). 

Thank you,
Jni
Iliana Dyankova
Telerik team
 answered on 04 Oct 2013
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
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
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?