Telerik Forums
UI for ASP.NET MVC Forum
5 answers
1.2K+ views
Is it possible to filter a column from a drop down list (from a foreign key look up table) - and if so what's the best way to do this?

The only way I can see to do this a present, is using a toolbar template - which isn't ideal but would be ok, but the example isn't for the MVC extensions ( http://demos.kendoui.com/web/grid/toolbar-template.html ), and it seems there should be an easier way in MVC.

Any examples would be helpful.

Thanks
Daniel
Top achievements
Rank 1
 answered on 16 Aug 2013
1 answer
183 views
<div class="k-block">
    <div class="k-header k-shadow"><span class="k-icon k-i-pencil"></span>Employee Colour</div>
    <div class="editor-label">
            @Html.LabelFor(x => x.BackgroundColour)
        </div>
        <div class="editor-field">
            @(Html.Kendo().ColorPicker().Name("BackgroundColour").Palette(ColorPickerPalette.Basic).Value(Model.BackgroundColour))
            @Html.TextBoxFor(x => x.BackgroundColourInput, new { @class = "editor-colour"})
        </div>
        <br />
        <div class="editor-label">
            @Html.LabelFor(x => x.TextColour)
        </div>
    <div class="editor-field">
        @(Html.Kendo().ColorPicker().Name("TextColour").Palette(ColorPickerPalette.Basic).Value(Model.TextColour))
         @Html.TextBoxFor(x => x.TextColourInput, new { @class = "editor-colour"})
    </div>
    <br/>
</div>
I'm using the code above to load a colour picker, the Model.BackgroundColour and Model.TextColour are strings as below:

rgb(0,255,255)

but when the form loads, the initial colour is always black, can someone tell me what I'm doing wrong please, as looking at the documentation it seems this should work. I should also point out that passing a string as below:

#00FFFF

does work.

Thanks.
Dimiter Madjarov
Telerik team
 answered on 16 Aug 2013
3 answers
270 views
Hello,
i am using Vs2012,kendo 2013.1.154 version,
and i want it to do the dropdown cascade example,and it gives me in firebug,that he doesn't know that javascript function put as filter
the error message is : filterProducts is not defined
here is my view
<div class="demo-section">
    <h2>View Order Details</h2>
    <p>
        <label for="categories">Catergories:</label>
        @(Html.Kendo().DropDownList()
              .Name("groups")
              .HtmlAttributes(new { style = "width:300px" })
              .OptionLabel("Select group...")
              .DataTextField("Name")
              .DataValueField("pkTallyGroup")
              .DataSource(source => {
                   source.Read(read => {
                       read.Action("GetCascadeGroups", "Employees");
                   });
              })
        )
    </p>
    <p>
        <label for="subgroups">Products:</label>
        @(Html.Kendo().DropDownList()
              .Name("subgroups")
              .HtmlAttributes(new { style = "width:300px" })
              .OptionLabel("Select subgroup...")
              .DataTextField("Name")
              .DataValueField("pkTallySubGroup")
              .DataSource(source => {
                  source.Read(read =>
                  {
                      read.Action("GetCascadeSubgroups", "Employees")
                          .Data("filterProducts");
                  })
                  .ServerFiltering(true);
              })
              .Enable(false)
              .AutoBind(false)
              .CascadeFrom("groups")
        )
        <script>
            function filterProducts() {
                return {
                    groups: $("#groups").val()
                };
            }
        </script>
    </p>
    
</div>

what should be the problem?or do i need to set something in VS2012 to see the scripts in the same page?
Regards,
Daniel
Vladimir Iliev
Telerik team
 answered on 16 Aug 2013
6 answers
185 views
Hello,
i have another question:
I would like to filter the grid data,based on some filters(textboxes or dropdowns) and when i press a button,the date will be loaded into the kendo grid.But initially i do not want to fill anything.based on filter inputs,i create the criteria and make the selection in where clause of the repository for the given entity.
How can i do that?can you show me an example?
Best Regards,
Daniel
Nikolay Rusev
Telerik team
 answered on 16 Aug 2013
0 answers
180 views
Hi to all Members.I have installed Kendo and i am using a very basic Grid
I have bind it successfully but paging sorting doesn't seems to Work

This is my View
@model IEnumerable<UserManagementApplication.Models.tblUser>
@{
    ViewBag.Title = "GetDataKendo";
}
<h2>GetDataKendo</h2>
   
@(Html.Kendo().Grid(Model)  
    .Name("Grid")
     .Columns(columns =>
      {        
          
          columns.Bound(model => model.FirstName);
          columns.Bound(model => model.LastName);
          columns.Bound(model => model.EmailAddress);
          columns.Bound(model => model.IsActive);
      })
      
    .Pageable()
    .Sortable()
    .Filterable()
    .Scrollable()
    .Groupable()
    .DataSource(dataSource => dataSource
        .Ajax()
        .Read(read => read.Action("GetUserDataKendo", "User")
        )
    )
)

And this is my Controller Method
 public ActionResult GetUserDataKendo([DataSourceRequest]DataSourceRequest request)
        {                   
            
            var displayedEvents = client.GetUserList(1, 100, "", false, "");      
           var result = new DataSourceResult()
            {
                Data = displayedEvents
            };
            return Json(result);
        }


My problem is that Paging Sorting are not working .Please see attached Image that how my image is showing

Jack
Top achievements
Rank 1
 asked on 16 Aug 2013
2 answers
2.5K+ views

I have created a single page application with Kendo Grid.  and users have different roles. I need to Hide and show buttons on  User Role Type.
Chrys
Top achievements
Rank 1
 answered on 15 Aug 2013
3 answers
180 views
Hello,

We are having some problems with the image browser using the Kendo UI build v2013.2.716.

These problems can be replicated using the image browser demo (/razor/web/editor/imagebrowser) found in the Kendo.Mvc.Examples project provided with the Kendo UI install. These issues were also not present in the Q1 2013 release that we were using before.

When you try to upload an image:
The image uploads successfully but an image named "undefined" is added with the ajax spinner for a thumbnail.
Upon refreshing the page the uploaded image will show correctly in the list.

When you try to create a directory or when you try to delete an image/directory:
A request is posted to the create URL for every file in the list.

The posts look like this:
POST /razor/web/ImageBrowser/Create HTTP/1.1
Name=a100.png&Size=73289&EntryType=0&path=

POST /razor/web/ImageBrowser/Create HTTP/1.1
Name=aeroviewr.png&Size=15289&EntryType=0&path=

POST /razor/web/ImageBrowser/Create HTTP/1.1
Name=bg-glossy.png&Size=1128&EntryType=0&path=

Was some change overlooked and not committed into the code samples? Any workarounds for this?

Thank you
Alex Gyoshev
Telerik team
 answered on 15 Aug 2013
5 answers
479 views

Hi,

I looked at the example in  http://demos.kendoui.com/web/grid/editing-popup.html (ASP.NET MVC)

Kendo.Mvc.Examples.Models.ProductViewModel is a simple object,

I am interested in supporting Create and Update of an object that relates to other objects (in a Parent child manner)

For example : Lets say the grid shows  Students and a Student relates to Phones via StudentPhones
The popup should enable the user to edit/create a Student with its Phones all together.

I wonder if you can supply me  a project that shows how to handle the Create and Update in a similar scenario to the one I described.

 

Thanks in advance.

Lauri

p.s. My app is an N-Tier app using EntityFramework

 

Vladimir Iliev
Telerik team
 answered on 15 Aug 2013
1 answer
101 views
I have a grid where a filter gets set through the API automatically, but I want to be able to display what that current filter is, and allow the under to easily remove it.  I'm thinking of using MultiSelect to accomplish this purely from the standpoint of how it looks to the user and could allow them to click on that X to easily remove the filter.  But I'm not sure this is the right or even a workable approach.  I figure before I go to effort to try to implement this and go through testing, that I'd ask the experts here and see what your recommendations may be to accomplish something like this.

Any input would be most appreciated, thank you!
Vladimir Iliev
Telerik team
 answered on 15 Aug 2013
2 answers
626 views
I am having the following issue when I’m using Kendo UI Grid in partial view loaded by Ajax.ActionLink.
Sorting and everything works as long as I‘m not adding any events, but I need to use Change event in order to implement
 Master-Child grid.
After I add the event, sorting stops working, event is not firing. My test code is
Controller
public class TestKendoAjaxController : Controller
    {
        public ActionResult Index()
        {           
           return View();
       }
        public ActionResult PartialGrid()
        {
            List<TestKendoAjaxModel> result = new List<TestKendoAjaxModel>();
            result.Add(new TestKendoAjaxModel { FirstName = "Test1", LastName = "test1Last" });
            result.Add(new TestKendoAjaxModel { FirstName = "test2", LastName = "test2Last" });
            Main nn = new Main();
            nn.blah = result;
            return PartialView("_TestPartial", nn.blah);
        }
          [HttpPost]
        public ActionResult Data_Read([DataSourceRequest]DataSourceRequest request)
        {
            List<TestKendoAjaxModel> result = new List<TestKendoAjaxModel>();
            result.Add(new TestKendoAjaxModel { FirstName = "test1", LastName = "test1Last" });
            result.Add(new TestKendoAjaxModel { FirstName = "test2", LastName = "test2Last" });
            return
Json(result.ToDataSourceResult(request));
       }
   }

View

@model Johnson.OAT.MVC4.Models.Main
@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<p>
@Ajax.ActionLink("Load partial view", "PartialGrid", new AjaxOptions
{
    OnSuccess = "updatePlaceholder",
    UpdateTargetId = "result"
})
</p>

 <div id="result"></div>
<script type="text/javascript">
   function updatePlaceholder(context) {
        // the HTML output of the partial view
        var html = context.get_data();

        // the DOM element representing the placeholder
        var placeholder = context.get_updateTarget();

        // use jQuery to update the placeholder. It will execute any JavaScript statements
        $(placeholder).html(html);

        // return false to prevent the automatic update of the placeholder
        return false;
    }
</script>

Partial view

@model IEnumerable<Johnson.OAT.MVC4.Models.TestKendoAjaxModel>

 @(Html.Kendo().Grid(Model)
        .Name("Grid")
        .Columns(columns =>
        {
            columns.Bound(o => o.FirstName).Format("{0:d}").Width(80);
            columns.Bound(o => o.LastName).Width(200);
           
                             
        }).Sortable().Pageable(p => p.PageSizes(new[] { 20, 30, 50 })
        ).Filterable()
        .Selectable()
         .DataSource(datasource => datasource
           .Ajax()
           .Read(read=> read.Action("Data_Read","TestKendoAjax").Type(HttpVerbs.Post))
           
 )
 .Events(events => events.Change("change"))
 )


<script>
    function change(e) {
       alert("")
    }
</script>



 

Thank you in advance!

 

Halina
Halina
Top achievements
Rank 1
 answered on 14 Aug 2013
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
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?