Telerik Forums
UI for ASP.NET MVC Forum
1 answer
355 views
Hi,

I am trying to maintain state of kendo grid like Page Number,Page Size using session. I have referenced below example from your forum

http://www.telerik.com/support/code-library/save-grid-state-in-session-on-server-side

Problem is I don't have any button to Save or Load the grid state like above exmaple. 

I am saving the grid state on DataBound event of Grid and Loading the sate back from session in Document.ready function.

But its not working for me as  Index_Read function for Ajax binding of Grid  is always getting called first before LoadGridState function and thus session object is getting overridden with defualt values for pagesize, pageno etc.

Can you please help me on this.

Thanks
Aarti



Daniel
Telerik team
 answered on 05 Feb 2015
1 answer
251 views
I am having difficulty finding an example for binding the Kendo UI Grid for MVC 4 to a DataTable when using the ASPX view engine.

I reviewed the example in this forum http://www.telerik.com/support/code-library/binding-to-datatable-0191a594e359 and I am finding other examples using the Razor view engine.

Unfortunately, the MVC project to which I am assigned is very large and it is not a priority to convert to the Razor view engine at this time.  The priority is a conversion from MVC 2 to MVC 4 and it was expected the upgrade will go more quickly to stay with the ASPX view engine until a later date.

The requirements are
1. Stick with the ASPX view engine for now and 
2.  Upgrade the controls to work with MVC 4 (for this we are using the latest Kendo UI for MVC 4).

The binding scenario is to pull the DataTable from a session object called "GridResults" (That's right, it's not returned by the controller directly).

We also need to add the DataKeys to the grid when binding to the session-held DataSource.

If there are any examples of binding to a session DataSource returning a DataTable it would be appreciated.  Adding data keys would be a bonus.

Thank you
Atanas Korchev
Telerik team
 answered on 05 Feb 2015
4 answers
131 views
Hi

How do I make the listview scroll horizontally.

Thanks
Ant
Top achievements
Rank 1
 answered on 05 Feb 2015
8 answers
359 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
549 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
273 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
94 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
101 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
195 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
484 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
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
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
DateTimePicker
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?