Telerik Forums
UI for ASP.NET MVC Forum
3 answers
792 views

HI

 

Is there have a learning video forTelerik Reporting + MVC 5 (MVC 5, not MVC 4) like this :

Using Telerik Reporting in ASP.NET MVC 4 projects
https://www.youtube.com/watch?v=U2ZC9W9FYS0fs

 

The content of this old video is not works for MVC 5 (View Engine options for ASPX/Razor was removed).

 

Best regards

 

Chris

 

 

Chris
Top achievements
Rank 1
 answered on 26 Aug 2015
0 answers
120 views

I need to provide a Button like 'Add new record'  on Grid. On Click of that Button I need to display a Popup with displays rows from database in Grid. On selection of any row from Popup Grid I need to ​add that row to the Main Grid.

 

Please suggest me.

Mahendra
Top achievements
Rank 1
 asked on 26 Aug 2015
4 answers
1.8K+ views

is it possible to call a Jquery/Javascript function from an update ​section of a grid ?

 i want to perform some actions before calling the controller method, My code looks like below. Please help me

        dataSource: new kendo.data.DataSource({
            transport: {
                read:  {
                    url: crudServiceBaseUrl + "/Products",
                    dataType: "jsonp"
                },
                update: {
                    url: crudServiceBaseUrl + "/Products/Update",                                     // instead of URL i want to  call a custom Javascript function here
                    dataType: "jsonp"
                },

            },​

Naga
Top achievements
Rank 1
 answered on 25 Aug 2015
2 answers
110 views

Hello, I'm currently evaluating the controls for a project.  I'm currently able to display the grid and filter using regular filtering on the table.  I want to create a custom area in the page, using a collapsible panel where I add some textboxes and dropdown controls.  I want to use that panel to filter the grid. I haven't been successful yet. I understand that this can be done with js.  Are there any samples for a use like this?

 

Thanks for any help.

Atanas Georgiev
Telerik team
 answered on 25 Aug 2015
3 answers
169 views
I'm trying out Telerik for the first time but want to know what the plans are for MVC 6 and Visual Studio 2015.
Sebastian
Telerik team
 answered on 25 Aug 2015
4 answers
97 views

Hello,

 I have a problem in my grid, when i export to a excel file if i have filtered with a string that have spaces i lost the pagesize and i don't see data. The excel file is created but is empty. Only pass when i put in the filter a string with spaces.

 

Any idea?

Dimiter Madjarov
Telerik team
 answered on 25 Aug 2015
1 answer
262 views

I am trying to use the grid with a colorpicker to set a colorcode property on my model and even so the column is bound, I can never see the updated code when the model is sent to the controller.  I am using the standard in line editing function of the grid. (which manages to update teh model for simple properties.

CSHTML

@(Html.Kendo().Grid<Tetral.Services.Entities.AllocationPortfolioEntity>()
        .Name("grid")
        .Columns(columns =>
        {
            columns.Bound(p => p.ColourCode).Title("Colour").Width("84px").ClientTemplate("<span style='display: inline-block; width: 100%; height: 100%; background-color: #= ColourCode #'>&nbsp;</span>");
            columns.Command(m =>
            {
                m.Edit();
                m.Destroy();
            }).Width(260);    

        })
        .HtmlAttributes(new { style = "height:850px;width:100%" })
        .BindTo(@Model)
        .Scrollable(scr => scr.Enabled(true))
        .DataSource(dataSource => dataSource
            .Ajax()
            .Model(m => m.Id(p => p.Id))
            .Create(update => update.Action("AllocationPortfolioInsert", "DataManagement"))
            .Update(update => update.Action("AllocationPortfolioUpdate", "DataManagement"))
            .Destroy(update => update.Action("AllocationPortfolioDelete", "DataManagement"))
        )   

 

TEMPLATE

@model string
@(Html.Kendo().ColorPickerFor(m => m)
    //.Palette(ColorPickerPalette.Basic)
    .Name("ColourPicker")
    .Events(e => e.Change("colourPickerChange"))
)

 

MODEL

    private string colourCode;
        [UIHint("ColourPicker")]
        public string ColourCode
        {
            get { return colourCode; }
            set { this.colourCode = newValue;}
        }

Karl
Top achievements
Rank 1
 answered on 25 Aug 2015
1 answer
935 views

The control manages to bind and show the value from my model, but when I submit the form, the model in my controller does not show the updated value from the editor.

 

I have tried using a normal @Html.EditorFor() and this works as expected. (ie I see the updated value)

 

 @model GeneralDisclosureEntity

@using (Html.BeginForm("GeneralDisclosureTextUpdate", "DataManagement", FormMethod.Post, new { enctype = "multipart/form-data" }))
{    

    <div hidden="hidden">
        @Html.EditorForModel()
    </div>
    
            
    @(Html.Kendo().EditorFor(m => m.HTML)
          .Name("Content")
          .HtmlAttributes(new { style = "width:100%;height:440px" })
          .Encode(false)
          .Tools(t => t.Clear()
              .Bold()
              .Italic()
              .Underline()
              .Strikethrough()
              .JustifyLeft()
              .JustifyCenter()
              .JustifyRight()
              .JustifyFull()
              .InsertUnorderedList()
              .InsertOrderedList()
              .Indent()
              .Outdent())
    )

    <br />

  <button id="btnSubmit3" type="submit" style="float:right")>Save Text</button>
    
}

Alexander Popov
Telerik team
 answered on 25 Aug 2015
2 answers
1.3K+ views

Hi There

I've been trying to get this right, and none of the demos or forums posts appear to really give me a clear answer.

I'm trying to populate a dropdownlist from a related table (Foreign Key), and I'm getting a "Value cannot be null" error.

 

Here's the scenario:

I have a Courses and Cities table, defined like this,

public class City
  {
      [Key]
      [ScaffoldColumn(false)]
      public int CityId { get; set; }
 
      [Required]
      [DisplayName("City Name")]
      public string CityName { get; set; }
 
      public virtual ICollection<Course> Courses { get; set; }
  }

and this:

public class Course
  {
      [Key][ScaffoldColumn(false)]
      public int CourseId { get; set; }
 
      [Required]
      public string CourseName { get; set; }
 
      [ForeignKey("City")]
      [UIHint("GridForeignKey")]
      public int CityId { get; set; }
      public virtual City City { get; set; }
 
      [Required]
      [DisplayName("Course Rating")]
      [Range(0, 10)]
      public double CourseRating { get; set; }
 
      [Required]
      [DisplayName("Course Par")]
      public double CoursePar { get; set; }
 
      [DisplayName("Course Map Co-ords")]
      public string CourseMap { get; set; }
 
      [DisplayName("Course Notes")]
      public string CourseNotes { get; set; }
 
      public virtual ICollection<GolfRound> GolfRounds { get; set; }
 
 
  }

So, clearly it's just a Golf Score app I'm using to help me learn.

 I've scaffolded the Controller and Views using Kendo Scaffolder, and ended up with this:

public class CourseController : Controller
  {
      private GolfContext db = new GolfContext();
 
      public ActionResult Index()
      {
          return View();
      }
 
      public ActionResult Courses_Read([DataSourceRequest]DataSourceRequest request)
      {
          IQueryable<Course> courses = db.Courses;
          DataSourceResult result = courses.ToDataSourceResult(request, course => new
          {
              CourseId = course.CourseId,
              CourseName = course.CourseName,
              CourseRating = course.CourseRating,
              CoursePar = course.CoursePar,
              CourseMap = course.CourseMap,
              CourseNotes = course.CourseNotes
          });
 
          return Json(result);
      }
 
      [AcceptVerbs(HttpVerbs.Post)]
      public ActionResult Courses_Create([DataSourceRequest]DataSourceRequest request, Course course)
      {
          if (ModelState.IsValid)
          {
              var entity = new Course
              {
                  CourseName = course.CourseName,
                  CourseRating = course.CourseRating,
                  CoursePar = course.CoursePar,
                  CourseMap = course.CourseMap,
                  CourseNotes = course.CourseNotes
              };
 
              db.Courses.Add(entity);
              db.SaveChanges();
              course.CourseId = entity.CourseId;
          }
 
          return Json(new[] { course }.ToDataSourceResult(request, ModelState));
      }
 
      [AcceptVerbs(HttpVerbs.Post)]
      public ActionResult Courses_Update([DataSourceRequest]DataSourceRequest request, Course course)
      {
          if (ModelState.IsValid)
          {
              var entity = new Course
              {
                  CourseId = course.CourseId,
                  CourseName = course.CourseName,
                  CourseRating = course.CourseRating,
                  CoursePar = course.CoursePar,
                  CourseMap = course.CourseMap,
                  CourseNotes = course.CourseNotes
              };
 
              db.Courses.Attach(entity);
              db.Entry(entity).State = EntityState.Modified;
              db.SaveChanges();
          }
 
          return Json(new[] { course }.ToDataSourceResult(request, ModelState));
      }

 

and for the View:


@(Html.Kendo().Grid<GolfScoreMVC.Models.Course>()
      .Name("grid")
      .Columns(columns =>
      {
          columns.Bound(c => c.CourseName);
          columns.Bound(c => c.CourseRating);
          columns.Bound(c => c.CoursePar);
          columns.Bound(c => c.CourseMap);
          columns.Bound(c => c.CourseNotes);
          columns.ForeignKey(c => c.City, ( System.Collections.IEnumerable ) ViewData["Cities"], "CityId", "CityName");
          columns.Command(command => { command.Edit(); command.Destroy(); }).Width(180);
      })
      .ToolBar(toolbar =>
      {
          toolbar.Create();
      })
      .Editable(editable => editable.Mode(GridEditMode.PopUp))
      .Pageable()
      .Sortable(sortable =>
      {
          sortable.SortMode(GridSortMode.SingleColumn);
      })
      .Filterable()
      .Scrollable()
      .DataSource(dataSource => dataSource
          .Ajax()
          .Model(model => model.Id(p => p.CourseId))
          .Read(read => read.Action("Courses_Read", "Course"))
          .Create(create => create.Action("Courses_Create", "Course"))
          .Update(update => update.Action("Courses_Update", "Course"))
          .Destroy(destroy => destroy.Action("Courses_Destroy", "Course"))
      )
)

Now, initially the CityId column was not scaffolded at all, but in the Create popup, I got a CityId input field.

I added the "columns.ForeignKey(c => c.City, ( System.Collections.IEnumerable ) ViewData["Cities"], "CityId", "CityName");" part to try and produce a dropdownlist, but I'm not getting it right.

 

I'm using the default GridForeignKey template template file, and when rendering this, is where the error comes in.

 Please help me. The standard demo here confuses me even more.

Am I supposed to create a list of the Cities first, like this?

private GolfContext db = new GolfContext();
 
      public ActionResult Index()
      {
          IList<City> myCities = db.Cities.ToList();
 
          ViewData["Cities"] = myCities;
 
 
          return View();
      }

That doesn't work either. I'm clearly missing some obvious and simple step.

 

Regards

JohannS

 

 

 

 

Boyan Dimitrov
Telerik team
 answered on 25 Aug 2015
2 answers
39 views

I have a very basic model bound grid with edit and destroy commands.

 When the grid is in Edit mode, I press the cancel button and I expect the row to stay the same as before, however the grid deletes the row?  I have verified that it is not invoking any destroy methods

 

Karl
Top achievements
Rank 1
 answered on 24 Aug 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?