Telerik Forums
UI for ASP.NET MVC Forum
5 answers
287 views
I'm trying to follow the examples that I've found, but I seem to be missing something that prevents my results from sorting or grouping or paging. I'm assuming that the problem is in the controller, probably in GetEducators but I can't figure out what it is that I'm missing!

Index.html
@model LicenseVerification.Models.tc_person
 
@{
    ViewBag.Title = "SearchPerson";
}
 
<h2>Index cshtml</h2>
 
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")"type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")"type="text/javascript"></script>
 
@using (Html.BeginForm("SearchResults", "PersonSearch"))
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>tc_person</legend>
         
        <div class="editor-label">
            @Html.Label("first_name", "First Name")
        </div>
        <div class="editor-field">
            @Html.Editor("first_name", "First Name")
            @Html.ValidationMessageFor(model => model.first_name)
        </div>
 
        <div class="editor-label">
            @Html.Label("last_name", "Last Name")
        </div>
        <div class="editor-field">
            @Html.Editor("last_name", "Last Name")
            @Html.ValidationMessageFor(model => model.last_name)
        </div>
 
        <p>
            <input type="submit" value="Search" />
        </p>
    </fieldset>
}

PersonSearchController.cs
using System.Linq;
using System.Web.Mvc;
using LicenseVerification.Models;
using System.Collections;
 
namespace LicenseVerification.Controllers
{
    public class PersonSearchController : Controller
    {
        private be_cactusEntities db = new be_cactusEntities();
 
        public ActionResult Index()
        {
            return View();
        }
 
        public ActionResult SearchResults(string firstName = ""stringlastName = "")
        {
 
            return View(GetEducators(firstName,lastName));
        }
 
        private IEnumerable GetEducators(string firstName = ""stringlastName = "")
        {
 
            var educators = from e in db.tc_person
                             where e.first_name.Contains(firstName)
                             && e.last_name.Contains(lastName)
                             select e;
            ViewBag.firstName = firstName;
            ViewBag.lastName = lastName;
            return educators;
        }
 
 
        protected override void Dispose(bool disposing)
        {
            db.Dispose();
            base.Dispose(disposing);
        }
    }
}

SearchResults.cshtml
@model IEnumerable<LicenseVerification.Models.tc_person>
 
<h2> Without Partial</h2>
 
@{
    string lastName = "NULL";
    string firstName = "NULL";
    if (ViewBag.lastName != null)
    {
        lastName = ViewBag.lastName;
    }
    if (ViewBag.firstName != null)
    {
        firstName = ViewBag.firstName;
    }
         
}
@(Html.Kendo().Grid(Model)
        .Name("Grid")
        .Columns(cols =>
        {
            cols.Bound(p => p.person_id).Groupable(false);
            cols.Bound(p => p.first_name);
            cols.Bound(p => p.last_name);
        })
        .Pageable(pageable => pageable.PageSizes(true).PageSizes(new int[] { 10, 25 }))
        .Sortable()
)
 
<p />
lastName is @lastName<br />
firstName is @firstName

My model is from a DBContext template and Entity Framework, but it is below in case it's relevant:
tc_person.cs
//------------------------------------------------------------------------------
// <auto-generated>
//    This code was generated from a template.
//
//    Manual changes to this file may cause unexpected behavior in your application.
//    Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
 
using System;
using System.Collections.Generic;
 
namespace LicenseVerification.Models
{
    public partial class tc_person
    {
        public tc_person()
        {
            this.tc_experience = new HashSet<tc_experience>();
            this.tc_license = new HashSet<tc_license>();
            this.tc_certificate = new HashSet<tc_certificate>();
        }
     
        public decimal person_id { getset; }
        public System.DateTime date_record_added { getset; }
        public string prefix { getset; }
        public string last_name { getset; }
        public string first_name { getset; }
        public string middle_name { getset; }
        public string suffix { getset; }
        public string preferred_name { getset; }
        public string maiden_name { getset; }
        public string aka { getset; }
        public string ethnic_code { getset; }
        public string gender { getset; }
        public Nullable<System.DateTime> dob { getset; }
        public Nullable<System.DateTime> deceased_date { getset; }
        public string citizenship { getset; }
        public string nclb_veteran { getset; }
        public Nullable<System.DateTime> ethics_test { getset; }
     
        public virtual ICollection<tc_experience> tc_experience { getset; }
        public virtual ICollection<tc_license> tc_license { getset; }
        public virtual ICollection<tc_certificate> tc_certificate { getset; }
    }
     
}

PersonSearch.Context.cs
//------------------------------------------------------------------------------
// <auto-generated>
//    This code was generated from a template.
//
//    Manual changes to this file may cause unexpected behavior in your application.
//    Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
 
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
 
namespace LicenseVerification.Models
{
    public partial class be_cactusEntities : DbContext
    {
        public be_cactusEntities()
            base("name=be_cactusEntities")
        {
        }
     
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            throw new UnintentionalCodeFirstException();
        }
     
        public DbSet<tc_assignment> tc_assignment { getset; }
        public DbSet<tc_experience> tc_experience { getset; }
        public DbSet<tc_person> tc_person { getset; }
        public DbSet<tc_license> tc_license { getset; }
        public DbSet<tc_certificate> tc_certificate { getset; }
        public DbSet<tc_endorsement> tc_endorsement { getset; }
        public DbSet<tcc_license_level> tcc_license_level { getset; }
        public DbSet<tcc_license_status> tcc_license_status { getset; }
        public DbSet<tcc_qualified_by> tcc_qualified_by { getset; }
    }
}
Samuel
Top achievements
Rank 2
 answered on 11 Sep 2012
16 answers
234 views
I am trying to use the Kendo grid with an application I have, but I am getting a Just Code (2012.2.815.1) error "Unknown method 'Columns' of 'Kendo.Mvc.UI.Fluent.WidgetBuilderBase<TViewComponent, TBuilder>'. How can I resolve this error?

<%: Html.Kendo().Grid(Model.Registrants)
        .Name("Registrants")
        .Columns(column => 
            {
                column.Bound(i => i.RedemptionCode);
                column.Bound(i => i.FirstName);
                column.Bound(i => i.LastName);
                column.Bound(i => i.Address);
                column.Bound(i => i.Zip);
                
            }%>
<%%>
Zdravko
Telerik team
 answered on 11 Sep 2012
0 answers
130 views
I imagine this is pretty easy, but I'm still trying to get up to speed.  Anyone have an example of how to replicate the NoRecordsTemplate functionality using the Pageable.Message as recommended in the grid migration guide? 
gm
Top achievements
Rank 1
 asked on 10 Sep 2012
0 answers
143 views
Hi,

Can anyone provide me the link to open source MVC controls? 

I downloaded the version available in codeplex and I am unable to run it.. https://telerikaspnetmvc.codeplex.com/ 
Silver
Top achievements
Rank 1
 asked on 10 Sep 2012
2 answers
84 views
Hi there.

I have an Uploader control appearing in a dialog pop up, and the file count is always 0.

If i embed the control onto the main page, it works as expected, but i cannot get it work when in the pop up dialog box.

Is there a way i can get this work in a dialog please?

regards 
Michael
Top achievements
Rank 2
 answered on 10 Sep 2012
1 answer
115 views
Hello,
I need to perform some changes to the labels that appear in the pop-up editor before it is displayed to the user.  In ASP.NET MVC, I make these changes to the viewmodel that is sent to the view, but I am not sure how I can accomplish this same task using the pop-up editor.  Is there a way to intercept some kind of event?  I love this editor and hope to use it, but I need to resolve this issue.  I'd appreciate your comments and suggestions.

Thanks,
Mike
Rosen
Telerik team
 answered on 10 Sep 2012
1 answer
227 views
I've problems to format the (nullable) DateTime within a grid cell.
It shows me "/Date(1346849354810)/" instead the formatted date:

My Binding 

columns.Bound(p => p.Incentiv.CreatedDate).Format("{0:d}")
.ClientTemplate("#= (Incentiv.CreatedDate==null ? '':Incentiv.CreatedDate) #");

The second problem is, if I check of HasValue i get an undefined:

columns.Bound(p => p.Incentiv.CreatedDate).Format("{0:d}")
.ClientTemplate("#= (Incentiv.CreatedDate.HasValue ? '':Incentiv.CreatedDate.Value) #");

if i use GetValueOrDefault()  I get an error: "Bound columns require a field or property access expression."

columns.Bound(p => p.Incentiv.CreatedDate.GetValueOrDefault()).Format("{0:d}")
.ClientTemplate("#= (Incentiv.CreatedDate == null ? '':Incentiv.CreatedDate) #");
Mario Priebe
Top achievements
Rank 1
 answered on 10 Sep 2012
1 answer
273 views
Hi,

Using MVC 4 and Kendo UI Q2.

I have a PanelBar with a Listview in one of the panels, loaded from a PartialView. This works great.

However, when I add paging to the listview then the panel collapses each time I go to a new page. Happens in both Single and Multiple expand mode. So if thought I could subscribe to a NextPage event and do something to prevent this, but I cannot figure out how to get the paging event.


PanelBar    .vbhtml
@(Html.Kendo().PanelBar() _
    .Name("zone-panelbar") _
    .ExpandMode(PanelBarExpandMode.Single) _
    .Items( _
        Sub(panelbar)
                panelbar.Add().Text("Current Playlist") _
                    .LoadContentFrom("Get", "Playlist", New With {.id = currentZone.Id}) _
                    .Selected(True)
                panelbar.Add().Text("Other") _
                    .Content("<h2>Other</h2>")
        End Sub))


_Playlist.vbhtml
<script type="text/x-kendo-tmpl" id="template-playlist">
    <div class="playlist-panel-song">
${Artist} - ${Title}
    </div>
</script>

@(Html.Kendo.ListView(Of Player.Data.Song) _
    .Name("listview-playlist") _
    .ClientTemplateId("template-playlist") _
    .TagName("div") _
    .Pageable(
        Sub(pager)
                pager.Enabled(True)
                pager.Info(False)
                pager.Input(False)
                pager.Numeric(False)
                pager.PageSizes(False)
                pager.PreviousNext(False)
                pager.Refresh(False)
        End Sub) _
    .DataSource(
        Sub(dataSource)
                dataSource.Read("Read", "Playlist", New With {.id = Model.Id})
                dataSource.PageSize(9)
        End Sub)
)


Any help/advise/suggestions would be appreciated.
Alex Gyoshev
Telerik team
 answered on 07 Sep 2012
0 answers
150 views

Hi ,

When I am updating my server editing gridview from popup , The value which I am getting from other table after JOIN is not getting refreshed.

my grid view code
ResourceGroupTypeName is from other table.

 

@(Html.Kendo().Grid(Model)

.Name(

 

"resourceprop")

 

.Columns(columns =>

{

 

columns.Bound(p => p.ResourceGroupId).HtmlAttributes(

 

new { style = "text-align: left" }).Width(185); ;

 

columns.Bound(p => p.ResourceGroupName).HtmlAttributes(

 

new { style = "text-align: left" }).Width(190); ;

 

columns.Bound(p => p.ResourceGroupTypeName).HtmlAttributes(

 

new { style = "text-align: left" }).Width(230); ;

 

 

 

// columns.Bound(p => p.Description);

 

 

 

 

 

 

columns.Bound(p => p.Status).HtmlAttributes(

 

new { style = "text-align: center" }).Width(80);

 

columns.Bound(p => p.CreationDate).HtmlAttributes(

 

new { style = "text-align: right" }).Width(150).Format("{0:MM/dd/yyyy}");

 

columns.Command(command => { command.Edit(); });

})

 

 

// .ToolBar(toolbar => toolbar.Create())

 

 

 

 

 

 

.Editable(editable => editable.Mode(

 

GridEditMode.PopUp).TemplateName("popupgroup")

 

.Window(w => w.Title(

 

" Edit Resource Group").Name("editWindow")))

 

.Pageable(p => p.PageSizes(

 

true))

 



my dropdown in popup

@(Html.Kendo().DropDownList()

.Name(

 

"ResourceGroupTypeName")

 

.Value(

 

"ResourceGroupTypeId")

 

.OptionLabel(

 

"Select Group Type")

 

.DataTextField(

 

"ResourceGroupTypeName")

 

.DataValueField(

 

"ResourceGroupTypeId")

 

 

.DataSource(source =>

{

source.Read(read =>

{

read.Action(

 

"GetResourcetype", "ManageResource");

 

});

})

)

Vidushi
Top achievements
Rank 1
 asked on 07 Sep 2012
0 answers
143 views
i am not able to move to the next page in my grid my view code is
@(Html.Kendo().Grid<kendoglobalexample.Models.ViewModel.ProgramViewModel>(Model)
    .Name("Grid")
    .HtmlAttributes(new { style = "width: 700px; float: left;" })
    .Columns(columns =>
    {
        columns.Bound(p => p.Progarm1);
       
        
        columns.Command(command => { command.Edit(); command.Destroy(); }).Width(220);
    })
    .ToolBar(toolbar => toolbar.Create())
    .Editable(editable => editable.Mode(GridEditMode.InLine))
    .Pageable()
    .Sortable()
    
    .DataSource(dataSource => dataSource
        .Ajax()
        .Events(events => events.Error("error"))
        .ServerOperation(false)
        .Model(model => model.Id(p => p.ProgramId))
        .Create(update => update.Action("Globalization_Create", "Program"))
        .Read(read => read.Action("Globalization_Read", "Program"))
        .Update(update => update.Action("Globalization_Update", "Program"))
        .Destroy(update => update.Action("Globalization_Destroy", "Program"))
    )
)
and my controller code is

 public ActionResult Index()
        {
            return View(ProgramRespository.All());
            
        }
        public ActionResult Globalization_Read([DataSourceRequest] DataSourceRequest request)
        {
            return Json(ProgramRespository.All().ToDataSourceResult(request));
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Globalization_Create([DataSourceRequest] DataSourceRequest request, ProgramViewModel product)
        {
            if (product != null && ModelState.IsValid)
            {
                ProgramRespository.Insert(product);
            }

            return Json(new[] { product }.ToDataSourceResult(request, ModelState));
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Globalization_Update([DataSourceRequest] DataSourceRequest request, ProgramViewModel product)
        {
            if (product != null && ModelState.IsValid)
            {
                var target = ProgramRespository.One(p => p.ProgramId == product.ProgramId);
                if (target != null)
                {
                    target.Progarm1 = product.Progarm1;
                    
                    ProgramRespository.Update(target);
                }
            }

            return Json(ModelState.ToDataSourceResult());
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Globalization_Destroy([DataSourceRequest] DataSourceRequest request, ProgramViewModel product)
        {
            if (product != null)
            {
                ProgramRespository.Delete(product);
            }

            return Json(ModelState.ToDataSourceResult());
        }
    }
and also i am not able to add nor edit nor delete the data plz can you point out my mistake
siddharth
Top achievements
Rank 1
 asked on 06 Sep 2012
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
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?