Telerik Forums
UI for ASP.NET MVC Forum
2 answers
795 views
Hi,

I'm a longtime user of the UI for ASP.NET AJAX. I recently grabbed the demo of the UI for ASP.NET MVC and started playing around with it as I have a need for using MVC.

I have a toolbar on a page defined as follows:
@(Html.Kendo().ToolBar()
    .Name("toolbar")
)

I have a script that is calling a controller to load information on what toolbar items should be made available:
<script>
    $(document).ready(function() {
        $.post("/FileReview/DisplayToolbar/" + @ViewBag.FileReviewID + "/", function(buttonsToAdd) {
            var toolbar = $("#toolbar").data("kendoToolBar");
 
            for (var i = 0; i < buttonsToAdd.length; i++) {
                toolbar.add({
                    type: "button",
                    text: buttonsToAdd[i].Text,
                    imageUrl: buttonsToAdd[i].ImageUrl,
                    url: buttonsToAdd[i].NavigateUrl,
                    click: buttonsToAdd[i].ClickAction
                });
            }
        });
    });
</script>

The controller builds an array of ToolBarButtonModel:
public class ToolBarButtonModel
{
    public string Text { get; set; }
 
    public string ImageUrl { get; set; }
 
    public string ClickAction { get; set; }
 
    public string NavigateUrl { get; set; }
}

This works great for buttons that use the NavigateUrl. Buttons that use the click action are not working. I am guessing it is because I am passing a string of the function name to be called when adding the button on client side (the function to be called exists on the view already). It seems I must add a direct reference to a function here. Is there a way I can do this? Or perhaps there is a better approach for dynamically adding toolbar buttons?

Alexander Valchev
Telerik team
 answered on 13 Oct 2014
7 answers
229 views
I have no idea what I am missing here, but no matter what I try, I cannot get the count to be accessible using #=count#  I have this working with JavaScript by using a function to return the count but this count should be accessible according to the demo examples which I have been over many times, and cannot see my mistake. Calling the "#=ClockInStatusString(data)#" and  #=groupHeaderString(data)# works fine, the proper data is returned.

<div>
            @(Html.Kendo().Grid<viewmodel>()
          .Name("CampaignGrid")
          .Columns(columns =>
          {
              columns.Bound(c => c.FirstName).Sortable(true);
              columns.Bound(c => c.LastName);
              columns.Bound(c => c.ClockInDate);
              columns.Bound(c => c.ClockInTime);
              columns.Bound(c => c.ClockInStatus).ClientTemplate("#=ClockIStatusString(data)#").ClientGroupHeaderTemplate("#=groupHeaderString(data)# #=count#");
              columns.Bound(c => c.Campaign).ClientGroupHeaderTemplate("(Agents Count: #=count# )"); ;
              columns.Bound(c => c.UserName).ClientTemplate("<a href='/User/GetUserHistory/#= UserName#'>Activity</a>");
          })
          .Sortable(sort => sort.Enabled(true))
          .DataSource(datasource => datasource
              .SignalR()
              .Aggregates(aggregates =>
              {
                  aggregates.Add(c => c.ClockInStatus).Count();
                  aggregates.Add(c => c.Campaign).Count();
              })
              .Group(groups =>
              {
                  groups.Add(model => model.ClockInStatus);
                  groups.Add(model => model.Campaign);
              })
              .Transport(tr => tr.Promise("hubPromise")
                  .Hub("hub")
                  .Server(server => server
                      .Read("getClockedInUsers")
                      .Update("update")
                      .Destroy("desstroy")
                      .Create("create")))
              .Schema(scheme => scheme
                  .Model(model =>
                  {
                      model.Id(c => c.UserId);
                      model.Field(c => c.FirstName);
                      model.Field(c => c.LastName);
                      model.Field(c => c.ClockInDate);
                      model.Field(c => c.ClockInTime);
                      model.Field(c => c.Campaign);
                      model.Field(c => c.ClockInStatus);
                      model.Field(c => c.UserId);
                  }))
              )
            )
        </div>

Any help would be appreciated!
Thanks!

Vladimir Iliev
Telerik team
 answered on 13 Oct 2014
4 answers
1.7K+ views
has anyone had any success with the following?? the function does not get called. Thank you!

      .Editable(editing => editing.Mode(GridEditMode.PopUp).Window(w => w.Events(e => e.Close("OnClose"))))
Vladimir Iliev
Telerik team
 answered on 13 Oct 2014
1 answer
204 views
Hi:
Is there any way to export to Excel from the Kendo Grid without using open source tools like NPOI?
Thanks.
Atanas Korchev
Telerik team
 answered on 13 Oct 2014
1 answer
654 views
Hi -

I have the grid below and am trying to get the value of a certain column to dynamically render a set of workflow buttons based on that value.  Is it possible to do this?


Html.Kendo().Grid<ViewModelName>()
   .Name("GridName")
   .ToolBar(commands => commands.Create())
   .DataSource(ds => 
  ds.Ajax()
  .Read("Select", "EmpActivitySummary", new { EmpActivityId = RouteData.Values["id"] })
  .Update("Update", "EmpActivitySummary", new { EmpActivityId = RouteData.Values["id"] })
  .Destroy("Delete", "EmpActivitySummary")
  .Create("Insert", "EmpActivitySummary", new { EmpActivityId = RouteData.Values["id"] })
  .Model(m =>
  {
  m.Id(x => x.Id);
  m.Field(x => x.EmpActivityId).Editable(false);
  m.Field(x => x.Id).Editable(false);
  m.Field(x => x.Approved).Editable(false);
  })
   )  
   .PrefixUrlParameters(false)
   .Columns(r =>
   {           
r.Command(com =>
{
com.Edit();
com.Destroy();

var currentStatus = r.Template(model => model.Approved);  // <--------------- I'm trying to get the value of this column
var utilities = new WorkflowUtilities("Workflow Name");
var steps = utilities.GetSteps(currentStatus);

foreach (var step in steps.Where(step => Roles.IsUserInRole(step.RequiredRole)))
{
com.Custom(step.ButtonText).Click("ProcessWorkflowStep").SendDataKeys(true);                        
}

}).Title("Commands").Width(60);
r.Bound(x => x.Id).Width(100);
r.Bound(x => x.Field);
r.Bound(x => x.Quantity);
r.Bound(x => x.Price).AsCurrency();
r.Bound(x => x.Date);
r.Bound(x => x.Approved);
    
   })
   .Render();
Dimiter Madjarov
Telerik team
 answered on 10 Oct 2014
1 answer
90 views
Hi,

How to export to excel after having re-ordered the columns, with the new column order

Thanks,
Annie
Atanas Korchev
Telerik team
 answered on 10 Oct 2014
1 answer
165 views
Hi There,

I am facing an issue when trying to use multi-select control in grid filter.

I have gone through the following link - http://www.telerik.com/forums/multi-select-in-grid-filter-template

The UI of multiselect does not persist the value when I filter the multiselect column and go to some other column and filter it and come back to multiselect column it does not display values on UI but it retains the values on multiple columns search with other filters.

It works when I remove data-bind but I cannot apply filter simultaneously with other filters.

Please help me to achieve both persistent search and filtering multiple columns simultaneously.

Petur Subev
Telerik team
 answered on 10 Oct 2014
1 answer
120 views
Hi,

I am using kendoGrid() to display data, which receives from database in MVC model.

In this kendoGrid, we included "Edit" feature given by kendoGrid.  But when trying to update the data,  the cursor is going into the controller, but the parameter(model) for that action contains null data. i.e. the data is not getting posted from view to controller.

for your reference, I have attached the code files.

Thanks in advance.

Swarnalatha
Alexander Popov
Telerik team
 answered on 09 Oct 2014
3 answers
211 views
Hi,

Is there a sample code for adding a MVC kendo UI grid in a partial view, and setting its datasource and columns in a view

Thanks,
Annie
Dimiter Madjarov
Telerik team
 answered on 09 Oct 2014
1 answer
1.0K+ views
In one of my pages I am trying to load data when DropDown
Value is changed. However I have hard time in call contoller’s action method on
dropdown’s onchange event. If you have any sample available please share with
me.

Georgi Krustev
Telerik team
 answered on 09 Oct 2014
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
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
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
Cynthia
Top achievements
Rank 1
Iron
Jesse
Top achievements
Rank 2
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Jesse
Top achievements
Rank 2
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?