Telerik Forums
UI for ASP.NET MVC Forum
1 answer
141 views
I am trying to implement an Autocomplete on a partial view.  The model contains the data in a property called AvailableMatters which is an IEnumerable<Matter>.  Matter has a property called "Name" which is what I want to display and have users type in the autocomplete box.

Looking at the html that is being rendered, it's got my data in the autocomplete widget.  However, nothing happens when you type in the autocomplete box. 
This is the html that is being rendered:
 <input id="activeMatterID" name="activeMatterID" type="text" />
<script>
    jQuery(function(){jQuery("#activeMatterID").kendoAutoComplete({"select":activeMatterIDSelected,"change":activeMatterIDChanged,
"dataSource":[{"MatterID":10259,"IsMasterDataset":false,"IsChildMatter":false,"ParentMatterID":0,"ParentMatterName":null,"Name":"01_Automated Test Matter","ClientID":3089,"ClientName":"01_AutomatedTestClient","SubClientID":0,"SubClientName":null,"Description":"","ServerID":1,"DatabaseName":"20_10259_3089_Matter_100062_22Jan13_052007","JobNumber":0,"Status":1,"StatusDisplay":1,"Priority":2,"EstimatedJobSizeInGb":0,"ArchiveLocation":null,"DBSchemaVersion":"5.0.0.0","AccountManagerID":21,"AccountManagerName":"Bob Jones","ClientMatterPO":"Matter Test","ContactName":"","ContactPhone":"","ProjectPath":null,"DisplayProjectPath":"","BackupNotes":null,"CurrentLoadVersion":null,"CreatedBy":67,"CreatedDate":"\/Date(1358896807610)\/","ModifiedBy":67,"LastModifiedDate":"\/Date(1358896807610)\/","LastAccessedDate":"\/Date(-62135575200000)\/","LastBackupDate":"\/Date(-62135575200000)\/","TimeZoneName":null},{"MatterID":10263,"IsMasterDataset":false,"IsChildMatter":false,"ParentMatterID":0,"ParentMatterName":null,"Name":"01_AutomatedTestMatter2","ClientID":3089,"ClientName":"01_AutomatedTestClient","SubClientID":0,"SubClientName":null,"Description":"","ServerID":1,"DatabaseName":"20_10263_3089_Matter_23Jan13_023035","JobNumber":0,"Status":1,"StatusDisplay":1,"Priority":2,"EstimatedJobSizeInGb":0,"ArchiveLocation":null,"DBSchemaVersion":"5.0.0.0","AccountManagerID":21,"AccountManagerName":"Bob Jones","ClientMatterPO":"987654","ContactName":"","ContactPhone":"","ProjectPath":null,"DisplayProjectPath":"","BackupNotes":null,"CurrentLoadVersion":null,"CreatedBy":67,"CreatedDate":"\/Date(1358973035963)\/","ModifiedBy":67,"LastModifiedDate":"\/Date(1358973035963)\/","LastAccessedDate":"\/Date(-62135575200000)\/","LastBackupDate":"\/Date(-62135575200000)\/","TimeZoneName":null},],
"dataTextField":"Name",
"placeholder":"Search..."});});
</script>

In Firebug if I look at the HTML view it actually shows me stuff I can't see from the page source, presumably digging down into the Kendo script somewhere:
<span class="k-widget k-autocomplete k-header k-state-default" tabindex="-1" role="presentation" style=""><input id="activeMatterID" class="k-input" type="text" name="activeMatterID" data-role="autocomplete" placeholder="Search..." style="width: 100%;" autocomplete="off" role="textbox" aria-haspopup="true" aria-disabled="false" aria-readonly="false" aria-owns="activeMatterID_listbox" aria-autocomplete="list"><span class="k-icon k-loading" style="display:none"></span></span>

Why does autocomplete="off"?  I don't see anywhere in the helper where I can explicitly turn this on?

And this is the helper code, which was derived from your documentation.
 @(Html.Kendo().AutoComplete()
          .Name("activeMatterID") //The name of the autocomplete is mandatory. It specifies the "id" attribute of the widget.
          .DataTextField("Name") //Specifies which property of the Matter to be used by the autocomplete.
          .BindTo(Model.AvailableMatters)   //Pass the list of Matters to the autocomplete.
          .Events(e => e.Select("activeMatterIDSelected").Change("activeMatterIDChanged"))
          .Placeholder("Search...")
          )

On screen it just looks like a blank textbox.  I do not even see the placeholder text.  I have the latest version  of these Kendo UI Complete plus MVC, I only downloaded it yesterday.

The change event does fire, the value is whatever got typed into the box (which generally isn't valid because no autocomplete occurred and users aren't going to know the exact name type type in.

We are not using any Telerik data sources, we have a custom WCF service we use to retrieve data so we do not want the autocomplete to bind to anything other than the data we pass in via the model.  I want to just capture the select & change events to call our own methods to act based on what they select.

So..what do I need to do to get the autocomplete to function (i.e. to autocomplete when a user types)?

As a second question, ideally I would like to capture not the text that they type but another field on the object associated with their selection.  The objects are Matters, we are showing the Matter.Name, but I would like to retrieve the Matter.MatterID and use this to act off of instead of the Matter.Name.  Is this possible, and how would I do this?  I can work off name if necessary but it's sub-ideal.  My main concern at the moment is getting the autocomplete to work.

Thanks in advance!
Robert
Top achievements
Rank 1
 answered on 16 Apr 2013
0 answers
140 views
Please help with rendering a byte array.
Jeremy
Top achievements
Rank 1
 asked on 16 Apr 2013
0 answers
133 views
Good morning,

I'm having the same issue seen here:
http://www.kendoui.com/forums/permalink/4pdb6wyQTUWsacYhmciO0w. (I've
also seen a few other posts about this same issue)

Unfortunately I don't understand the answer.  Could someone please provide a little more detail about what the answer means?

Thanks!
Jeremy
Top achievements
Rank 1
 asked on 16 Apr 2013
1 answer
546 views
Hello,
There seem to be several examples dotted around the place on how to handle Model State errors
e.g. How do I display model state errors?
http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/faq
However I cannot find any documentation on how to create the error on the server in the first place.
Any hint of what needs to replace the comments shown below, would be much appreciated.
Regards,
Pete
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Update_User([DataSourceRequest] DataSourceRequest request, UserProfile userprofile)
{
  if (userprofile != null && ModelState.IsValid)
  {
    if (errorcondition)
    {
      //raise something here that will be picked up by the onError function described above
      //to inform the user that some sort or error occured
    }
  }
  else
  {
    //raise something here that will be picked up by the onError function described above
    //to inform the user that the ModelState.IsValid is Invalid
  }
  return Json(ModelState.ToDataSourceResult());
}


Vladimir Iliev
Telerik team
 answered on 16 Apr 2013
1 answer
163 views
Grid values do not seem to use the DisplayTemplate as defined.  Is there something to do to get them to use them?

I suppose as an alternative I could use the ClientRowTemplate and do it that way, but seems over kill.
Dimiter Madjarov
Telerik team
 answered on 16 Apr 2013
2 answers
351 views
Hello!
I want  editing as here  http://www.kendoui.com/code-library/mvc/grid/using-multiselect-in-grid.aspx and 

I have Model:
public class ShrinkCoeffModel
    {
        [Display(Name = "thickness")]
        public virtual int Thickness { get; set; }
           
        [Display(Name = "wett")]
        public virtual string[] Wetness { get; set; }
   
        [Display(Name = "coeff")]
        public virtual decimal[] Coeff { get; set; }
    }
and Grid: (1.png)
@(
 Html.Kendo().Grid(Model)
                .Name("ShrinkCoeff")
                .ToolBar(commands =>
                {
                    commands.Create();
                })
                .Columns(columns =>
                {
                    columns.Bound(o => o.Thickness);
                    for (int i = 0; i < Model.FirstOrDefault().Wetness.Count(); i++)
                    {
                    columns.Bound(o => o.Wetness[i]);
                           
                    }
                    columns.Command(command =>
                    {
                        command.Edit();
                        command.Destroy();
                    }).Width(210).Title("Действия");
                })
                .Editable(editable => editable.TemplateName("Item").Mode(GridEditMode.PopUp))
                .DataSource(dataBinding => dataBinding
                    .Server()
                                                    .Model(model => model.Id(o => o.Thickness))
                                                        .Update("Edit", "ShrinkCoeff")
                                                        .Create("Create", "ShrinkCoeff")
                                                        .Destroy("Delete", "ShrinkCoeff"))
                .Pageable()
                .Sortable()
                .Selectable()
)
And if I click Edit I see this: 2.png 

But I want :

first Wetness             first Coeff                                                     
second Wetness      second Coeff  
.....                                  ......

how to display  also to and edit
how I can this do?

(I can pass my model to EditorTemplates and use:
@foreach(Type item in Model)
{
......) 
There are other ways?)
Gusev
Top achievements
Rank 1
 answered on 15 Apr 2013
1 answer
165 views
I want use text box in form or grid that user can only select value from special list for this action I want show button inside textbox and user click on this button an show list on data and after select special record the value of select record show on text box and popup window close.
Saeid
Top achievements
Rank 1
 answered on 15 Apr 2013
0 answers
115 views
Hi
I want create a page that show data of a table in form style I want use anythings like paging and arrow key to navigate between records (like grid control) on this page, kendo don't have anything for this purpose?
Saeid
Top achievements
Rank 1
 asked on 14 Apr 2013
0 answers
143 views
For example ,I want to find the object that its id in "101,1011,1001' and name "Lucy" called filterstring.Need I have to filter 3 times?
$("#Grid").data("kendoGrid").dataSource.filter([
{ field: "id", operator: "eq", value: "101"},
{ field: "id", operator: "eq", value: "1001"},
{ field: "id", operator: "eq", value: "1001"}
{ field: "name", operator: "eq", value: "Lucy"}
]);
PEIYANG
Top achievements
Rank 1
 asked on 14 Apr 2013
6 answers
316 views
I have a groupable grid which I have included a <br> it some of the column titles.
The column title displays correctly, but when I drag the column to the group area, the '<br>' is displayed in the column name.  I have attached a screen capture of the issue. 
I would be OK if the <br> were replaced by a space, or if it wapped..  any suggestions?
Thanks!

Below is the razor / view code:
@model Maris.Presentation.Models.EventSummary.EventSummaryMasterViewModel
@{
    ViewBag.Title = "Event Summary";
}
@(Html.Kendo().Grid(Model.Data)
.Name("EventSummary")
.DataSource(dataSource => dataSource
        .Server()
        .PageSize(20)
)
 
.CellAction(cell =>
{
    if (cell.Column.Title.Equals("Name"))
    {
        cell.HtmlAttributes["style"] = String.Format("background-color: {0}; color: {1}",
            cell.DataItem.VesselNameBackColor, cell.DataItem.VesselNameForeColor);
    }
    else if (cell.Column.Title.Equals("Type"))
    {
        cell.HtmlAttributes["style"] = String.Format("background-color: {0}; color: {1}",
            cell.DataItem.VesselTypeBackColor, cell.DataItem.VesselTypeForeColor);
    }
    else if (cell.Column.Title.Equals("Arrival<br>Time"))
    {
        cell.HtmlAttributes["style"] = String.Format("color: {0}",
            cell.DataItem.ArrivalTimeForeColor);
    }
    else if (cell.Column.Title.Equals("Departure<br>Time"))
    {
        cell.HtmlAttributes["style"] = String.Format("color: {0}",
            cell.DataItem.ArrivalTimeForeColor);
    }
    else if (cell.Column.Title.Equals("Arrival<br>Date"))
    {
        cell.HtmlAttributes["style"] = String.Format("background-color: {0}; color: {1}",
            cell.DataItem.ArrivalBackColor, cell.DataItem.ArrivalForeColor);
    }
    else if (cell.Column.Title.Equals("Departure<br>Date"))
    {
        cell.HtmlAttributes["style"] = String.Format("background-color: {0}; color: {1}",
            cell.DataItem.DepartureBackColor, cell.DataItem.DepartureForeColor);
    }
    else if (cell.Column.Title.Equals("Current<br>Berth"))
    {
        cell.HtmlAttributes["style"] = String.Format("background-color: {0}; color: {1}",
            cell.DataItem.CurrentBerthBackColor, cell.DataItem.CurrentBerthForeColor);
    }
    else if (cell.Column.Title.Equals("Current<br>Activity"))
    {
        cell.HtmlAttributes["style"] = String.Format("background-color: {0}; color: {1}",
            cell.DataItem.CurrentActivityBackColor, cell.DataItem.CurrentActivityForeColor);
    }
})
.Columns(columns =>
    {
        columns.Bound(d => d.Status);
        columns.Bound(d => d.Updated);
        columns.Bound(d => d.Quarantine);
        columns.Bound(d => d.Name);
        columns.Bound(d => d.Num);
        columns.Bound(d => d.Agent);
        columns.Bound(d => d.Type);
        columns.Bound(d => d.Flag);
        columns.Bound(d => d.CallSign);
        columns.Bound(d => d.MMSI);
        columns.Bound(d => d.Announce);
        columns.Bound(d => d.ArrivalDate)
            .Format("{0:MM/dd/yyyy}")
            .Title("Arrival<br>Date");
        columns.Bound(d => d.ArrivalTime)
            .Format("{0:HH:mm}")
            .Title("Arrival<br>Time");
        columns.Bound(d => d.DepartureDate)
            .Format("{0:MM/dd/yyyy}")
            .Title("Departure<br>Date");
        columns.Bound(d => d.DepartureTime)
            .Format("{0:HH:mm}")
            .Title("Departure<br>Time");
        columns.Bound(d => d.CurrentBerth)
            .Title("Current<br>Berth");
        columns.Bound(d => d.CurrentActivity)
            .Title("Current<br>Activity");
    })
    .Pageable(paging => paging
        .Refresh(true)
        .PreviousNext(true)
        .PageSizes(new []{ 20, 40, 80, 100 })      
        .Input(true)
    )
    .Groupable()
    .Sortable(sortable => sortable
            .AllowUnsort(true)
            .SortMode(GridSortMode.MultipleColumn))
    //.HtmlAttributes(new { style = "height:100%" }) 
    //.Scrollable()
    .Filterable()
    .ColumnMenu()
    .Resizable(resize => resize.Columns(true))
    .Reorderable(reorder => reorder.Columns(true))
     
)
Galen Giebler
Top achievements
Rank 1
 answered on 12 Apr 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?