Telerik Forums
UI for ASP.NET MVC Forum
4 answers
126 views
Hi

How do I make the listview scroll horizontally.

Thanks
Ant
Top achievements
Rank 1
 answered on 05 Feb 2015
8 answers
352 views
Hi,

I have kendogrid with list of dropdown filters. 
I am stuggling to call the javascript to load the dropdown in the ready function.
Basically I am not able to find the dropdown element in the grid so that I can call the javasript to load the dropdown again.

View Code:

  @using (Html.BeginForm("ReplaySelectedInboundMessages", "Home"))
   {
    <div id="gridContent">
       <h1></h1>  
    @(Html.Kendo().Grid<ViaPath.MessageReplay.MvcApp.Models.LogModel>(Model)
    .Name("gridTable") 
   //.EnableCustomBinding(true)
    .HtmlAttributes(new {style = "font-family: verdana,arial,sans-serif; font-size: 11px;color: #333333;border-color: #999999;"})       
    .Columns(columns => 
        {
          columns.Template(@<text><input class="box"  id="assignChkBx" name="assignChkBx" type="checkbox" value="@item.LogID"/></text>).HeaderTemplate(@<text><input class="selectAll" type="checkbox" id="allBox" onclick="toggleSelection()"/></text>).Width(20);
            //columns.Template(p => { }).ClientTemplate("<input type='checkbox' #= CheckSelect ? checked='checked':'' # class='chkbx' />");
                    
            columns.Bound(p => p.LogID).Template(p => Html.ActionLink(((string)p.LogID), "MessageDetails", new { logid = p.LogID })).Width(200);
            columns.Bound(p => p.ReceivePortName).Width(100).Filterable(ft => ft.UI("ReceivePortsFilter")); //.Filterable(ftb => ftb.Cell(cell => cell.Operator("contains")));
            columns.Bound(p => p.SendPortName).Width(100).Filterable(ft => ft.UI("SendPortsFilter"));
            columns.Bound(p => p.loggedDate).Format("{0:MM/dd/yyyy hh:mm tt}").Filterable(f => f.UI("DateTimeFilter").Extra(true)).Width(100);
            columns.Bound(p => p.ControlID).Width(100);
            columns.Bound(p => p.SenderID).Width(100).Filterable(ft => ft.UI("SenderIDFilter"));
            columns.Bound(p => p.ReceiverID).Width(100).Filterable(ft => ft.UI("ReceiverIDFilter"));
            columns.Bound(p => p.InterchangeID).Width(100);
            columns.Bound(p => p.ReplayedCount).Width(100);
            columns.Bound(p => p.RetryCount).Width(100);
            columns.Bound(p => p.AckCode).Width(20);
        })
           // .Filterable(ftb => ftb.Mode(GridFilterMode.Row))
            .Filterable()
            .Pageable(page => page.PageSizes(new int[]{10,25,50,100}).Enabled(true))
            .Sortable()
            .Scrollable(src => src.Height("auto"))
            .Resizable(resize => resize.Columns(true))
            )

         <br />
        <br />
        <input type="Submit" name="btnReplayMessage" value="Replay" title="Replay Message" \>
</div>  
      <script type="text/javascript">
          function ReceivePortsFilter(element) {
              element.kendoDropDownList({
                  dataSource: {
                      transport: {
                           read: "@Url.Action("FilterMenuCustomization_ReceivePorts")"
                          
            }
        },
        optionLabel: "--Select Value--"
    });
          }



          function SendPortsFilter(element) {
              element.kendoDropDownList({
                  dataSource: {
                      transport: {
                          read: "@Url.Action("FilterMenuCustomization_SendPorts")"

                      }
                  },
                  optionLabel: "--Select Value--"
              });
          }

          function ReceiverIDFilter(element) {
              element.kendoDropDownList({
                  dataSource: {
                      transport: {
                          read: "@Url.Action("FilterMenuCustomization_ReceiverID")"

            }
        },
        optionLabel: "--Select Value--"
    });
          }

          function SenderIDFilter(element) {
              element.kendoDropDownList({
                  dataSource: {
                      transport: {
                          read: "@Url.Action("FilterMenuCustomization_SenderID")"

                      }
                  },
                  optionLabel: "--Select Value--"
              });
          }


          function DateTimeFilter(control) {
              $(control).kendoDateTimePicker();
          }

          $(document).ready(function () {
              
             
              
              
              var grid = $("#gridTable").data("kendoGrid");
              var dropdown = grid.pager.element
                               .find(".k-pager-sizes [data-role=dropdownlist]")
                               .data("kendoDropDownList");

              var item = {};
              item[dropdown.options.dataTextField] = "All";
              item[dropdown.options.dataValueField] = 1000000;
              dropdown.dataSource.add(item);

              dropdown.bind("change", function (e) {
                  if (this.text() == "All") {
                      grid.one("dataBound", function () {
                          setTimeout(function () {
                              dropdown.span.text("All");
                          });
                      });
                  }
              });
          });
      </script>
       
   }
   
   Controller Code:
   public ActionResult AllMessages([DataSourceRequest(Prefix = "gridTable")] DataSourceRequest request)
        {
            //var filterCollection = KendoGridFilterCollection.BuildCollection(Request);
            List<LogModel> logs = null;
             if (request.Filters == null)
                logs = this.GetAllMessages().Where(x => x.loggedDate >= DateTime.Today.AddDays(-7)).ToList();
             else
                 logs = this.GetAllMessages();
            
            Session.Clear();
            Session["ReceivePortsList"] = logs.OrderBy(e => e.ReceivePortName).Select(a => a.ReceivePortName).Distinct();
            Session["SendPortName"] = logs.OrderBy(e => e.SendPortName).Select(a => a.SendPortName).Distinct();
            Session["SenderID"] = logs.OrderBy(e => e.SenderID).Select(e => e.SenderID).Distinct();
            Session["ReceiverID"] = logs.OrderBy(e => e.ReceiverID).Select(e => e.ReceiverID).Distinct();

            return View(logs);
        
        }

        public ActionResult FilterMenuCustomization_ReceivePorts()
        {

            //List<LogModel> logs = this.GetAllMessages();
            //return Json(logs.Select(e => e.ReceivePortName).Distinct(), JsonRequestBehavior.AllowGet);

            return Json(Session["ReceivePortsList"], JsonRequestBehavior.AllowGet);
           
        }
Alexander Popov
Telerik team
 answered on 05 Feb 2015
3 answers
535 views
Hi Everyone --

I cannot get my Edit popup window to fire. I don't see any events happening when I debug the application. My add user function works quite well. 

Any ideas why this is?

@(Html.Kendo().Grid<
Areas.Admin.ViewModels.UserManagement.UserManagementVM>()
                .Name("UserProfileGrid")
                .Resizable(c => c.Columns(true))
                .Selectable()
                .Filterable()
                .Groupable()
             .ToolBar(toolbar =>
                    {
                        toolbar.Template(@<text>
 
 
                            <input id="ButtonAddUser" type="button" class='k-button k-grid-add' value="Add User"/>
                            <input id="ButtonEditUser" type="button" class="k-button k-grid-edit" value="Edit user" />
                             
                        @(Html.Kendo().Button()
                        .Name("ButtonRefreshPage")
                        .HtmlAttributes(new { type = "k-button" })
                        .Icon("history")
                        .Content("Refresh Page")
                        .Events(x => x.Click("RefreshPage")))
 
                        @(Html.Kendo().Button()
                        .Name("ButtonDeleteUser")
                        .HtmlAttributes(new { type = "k-button" })
                        .Icon("history")
                        .Content("Delete a user")
                        .Events(x => x.Click("DeleteUser")))
 
                        @(Html.Kendo().Button()
                        .Name("ButtonAbout")
                        .HtmlAttributes(new { type = "k-button" })
                        .Icon("history")
                        .Content("About")
                        .Events(x => x.Click("aboutButtonClick")))
                        </text>);
                    })
 
                    .Editable(editable => editable.Mode(GridEditMode.PopUp)
                    )
 
                    .Columns(columns =>
                    {
                        //columns.Bound(e => e.UserOrg).Width(25).Title("User Organization");
                        columns.Bound(e => e.IsApproved).Width(50).Title("Approved Status");
                        columns.Bound(e => e.UserName).Width(150).Title("User Name");
                        //columns.Bound(e => e.user).Width(150);
                        columns.Bound(e => e.EmailAddress).Width(150).Title("Email Address");
                    })
 
                    .Sortable()
                    .Scrollable()
                    .Pageable()
                    .Filterable()
                    .Selectable()
                    .Events(e =>
                    {
                      e.Change("packageRowSelectionChanged");
                    })
                    .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Events(E => E.Error("error_handler"))
                    .Model(model => model.Id(e => e.UserId))
                    .Read(read => read.Action("ReadUsers", "UserManagement"))
                    .Create(create => create.Action("UserProfileCreator", "UserManagement"))
                    .Update(update => update.Action("UserProfileCreator", "UserManagement"))
                    .Destroy(destroy => destroy.Action("EditingPopUp_Destroy", "UserManagement"))
                    ))
Michael
Top achievements
Rank 1
 answered on 04 Feb 2015
2 answers
267 views
Hello,

I am trying to make a grid (done) having a client template (done) having a hyperlink (done). When I click on the hyperlink, it should open a window (from the suite of Telerik ASP.NET MVC controls). However, when I write the javascript function and the html within the client template, it does not function as intended.

I am not posting my code because I am interested in an example of how to do something like that. Would someone be able to post an example, please?

Just to re-coup:

1) There is a grid.
2) Within the grid, there is a column, specified by client template.
3) Within the client template, there is a link.
4) Clicking on that link should open a Telerik ASP.NET MVC window and load custom content from the server via AJAX into that window.
5) For every row of the grid, different content should be loaded into the window. The window could be re-used or specified separately for each row (preferably, reused, but any working example will do).

Thank you in advance for your help.

Alexander Popov
Telerik team
 answered on 04 Feb 2015
5 answers
91 views
The link that currently is pointing to the documentation for the Map helper returns a 404:

http://docs.telerik.com/kendo-ui/aspnet-mvc/helpers/map/overview

If I try looking up the documentation in the helpers list, I do not see the Map helper listed. Will this be fixed any time soon?
T. Tsonev
Telerik team
 answered on 04 Feb 2015
2 answers
96 views
Hi

I have a splitter and i'd like one of the panes to render as collapsed when the page loads? Is this easily done?

Thanks
Alex Gyoshev
Telerik team
 answered on 03 Feb 2015
1 answer
187 views
Hi,

We are using the Kendo UI Grid with batch editing mode (in-cell).

The problem is when the user is editing a cell and in edit mode, if the user tries to sort the column, the editor control disappears along with the validation.

We need to show the validation in the grid till the validation rules are not satisfied.

Our requirement is that the control should remain visible even if the user sorts the grid.

Or can we disable sorting on the grid when the user is in edit mode?

Can you please give a good solution for this?

Regards,
Alexander Popov
Telerik team
 answered on 03 Feb 2015
2 answers
463 views
I have little experience with the Kendo Grid HTMLHelper for ASP.Net MVC and have a couple of different scenarios in which I ideally need to specify multiple model items to be used in a "Columns.Bound()" clause for an @Html.kendo.grid declaration.   One is where I need to concatenate two model items for the value of a particular column.  

The other is where I need to have the title/tooltip for a column for one model item be the contents of another model item in that same row as in the following:

columns.Bound(model => model.modelItem1).Title("Reason Dump Taken").ClientTemplate("#= getTruncatedValue(modelItem1,36)#").Width(180).HtmlAttributes(new { title = " #= modelItem2 # "});

In both cases adding the 2nd model item, either as "modelItem2" or as "model.modelItem2" throw syntax errors.  I've searched this forum and others and haven't seen a syntax for simply implementing the first one.  

I did see a more lengthy workaround for the second that involved registering a javascript function to be called when a tooltip was requested; getting the grid row in that function, and trying to provide the 2nd model item via that mechanism. 

But it would be much easier if I could just specify something more like title = " #= modelItem2 # ".

Thanks in advance,
-Bob
Dimiter Madjarov
Telerik team
 answered on 03 Feb 2015
5 answers
220 views
Telerik is seriously deficient with its Data Access toolset by not providing a way to automatically scaffold controllers and views from models in an MVC project. See, by comparison, what Microsoft now supports for its own native system, Entity Framework - http://www.codeproject.com/Articles/685210/CRUD-Operations-Easy-with-New-Scaffolding-Feature.

I like Telerik's approach generally, and its tools including the data model diagramming, but data isn't created or edited out of thin air. Creating forms is a tedious, repetitive, time consuming (hence money consuming) task. If Telerik isn't going to support scaffolding, it's losing a big edge to Microsoft's own tools, and Data Access becomes significantly less valuable.

I see a lot of desire from various developers for this capability as I searched existing threads, but no indication of a serious effort to make scaffolding a priority. Any comments by Telerik on this?
Doroteya
Telerik team
 answered on 02 Feb 2015
4 answers
233 views
Good day,

I am using the ASP.NET MVC server side scheduler.  What is noticeably missing is a way, when one chooses to delete/edit an entire series of a recurring event, to specify

1.  Delete this entire series, or
2.  Delete the highlighted event and all future events in the series, but leave previous ones intact.

I understand how, behind the scenes, the original series would have to have its end date adjusted to the date prior to the selected event, and then a new series would have to be created with the new recurring event data.

Are there plans to add this functionality to the current delete/edit recurring event dialog?  Or are there examples of how one would accomplish this?

Still loving the scheduler, and thanks in advance for any assistance with this.

Adam
Adam
Top achievements
Rank 1
 answered on 02 Feb 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?