Telerik Forums
UI for ASP.NET MVC Forum
1 answer
197 views
Hi Everyone,

Here is my code snippet....
I need to know how to load the series data from information in the controller.
       <tr>
           <td>
              @* ToDo uncomment the follwing to activate Telerik Chart *@
               @(Html.Telerik().Chart<Qforma.Data.Physician>()
.Name("TimeSeries")
.Title(title => title.Text("Time Series"))
.Transitions(true)
 //.PlotArea(area => area.Background("#ccff00"))
.Legend(legend => legend.Position(ChartLegendPosition.Bottom)
)
.Series(series =>
{
    series.Bar(new int[] { 3015, 4003, 5881 }).Name("one");
    series.Bar(new int[] { 10458, 18598, 22623 }).Name("two");
})
.CategoryAxis(axis => axis
.Categories(new string[] { "Aug 2010", "Sept 2010", "Oct 2010" })
)
)
           </td>
       </tr>
Hubert
Top achievements
Rank 1
 answered on 08 Aug 2012
2 answers
361 views
Hi, I'm trying to create a Grid with Filterable option but the Icon does not showup in the column, looks like it is invisible and when I click in the corner the menu pops.  What am I missing?
Medina
Top achievements
Rank 1
 answered on 08 Aug 2012
0 answers
173 views
Currently we use a grid in batch edit mode.  When we click save changes, then the controller's Update method is called passing it all the updated rows.  Then the controller's Create method is called, passing it all the added rows.  Then the controller's delete method is called, passing it all the deleted rows.
Is it possible to, ( or if not, would you consider adding the feature) to configure the datasource to call a single "SaveAllChanges" controller method instead, which contains 3 parameters, one for the changed rows, one for the added rows and one for the deleted rows?
This is to enable scenarios in which the collection of rows needs to have validation applied that takes all rows into account.  For example, the items in the collection may not exceed a certain total Qty.  So if a user deletes one row, and adds another row, the controller will execute the Create method first, and this could cause a failure of the validation because of a defined Max Qty for all rows being exceeded; meantime the removal of the deleted row will actually cause validation to pass, but the Create method of the controller cannot know that when processing its validation.
Shawn
Top achievements
Rank 2
 asked on 08 Aug 2012
2 answers
175 views
Hi 

Im using kendoui 2012 q2.

Im trying to open a sub menu but it doesn't open when i hover over it.
Only when i define 
.OpenOnClick(true)
then when i click it, it's ok.

Thank you
Michele
Top achievements
Rank 1
 answered on 08 Aug 2012
0 answers
201 views
I need to check whether the user can see the column or not. I need to hide a column if the user has no permission
Benjamim
Top achievements
Rank 1
 asked on 07 Aug 2012
2 answers
472 views
The sort, group, and page functions are not working on my grid.  I have the code below and attached a picture of what happens when I try to group.  It's probably something simple but I'm not seeing it.

Layout:
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="@Url.Content("~/Content/kendo.common.min.css")">
    <link rel="stylesheet" href="@Url.Content("~/Content/kendo.default.min.css")">
     <script src="@Url.Content("~/Scripts/jquery-1.7.2.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/kendo.web.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/kendo.aspnetmvc.min.js")" type="text/javascript"></script>
</head>
<body>
    <div class="page">
        <header>
            <div id="title">
                <h1>
                    My MVC Application</h1>
            </div>
            <div id="logindisplay">
                Welcome <strong>@User.Identity.Name</strong>!
            </div>
            <nav>
                <ul id="menu">
                    <li>@Html.ActionLink("Home", "Index", "Home")</li>
                    <li>@Html.ActionLink("About", "About", "Home")</li>
                </ul>
            </nav>
        </header>
        <section id="main">
            @RenderBody()
        </section>
        <footer>
        </footer>
    </div>
</body>
</html>



View:
@model IEnumerable<QRC.Models.Milestone>
@{
    ViewBag.Title = "Column_Reordering";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>
    Column_Reordering</h2>
@(Html.Kendo().Grid(Model)
    .Name("Grid")
    .Columns(columns =>
    {
        columns.Bound(o => o.ID).Sortable(true).Filterable(false).Groupable(false);
        columns.Bound(o => o.Name).Sortable(true).Filterable(true).Groupable(true);
        columns.Bound(o => o.Sequence).Sortable(true).Filterable(false).Groupable(false);
        columns.Bound(o => o.TemplateType).Sortable(true).Filterable(true).Groupable(true);
    })
    .Pageable()
    .Sortable()
    .Scrollable()
    .Filterable()
    .Groupable()
    .Reorderable(reorder => reorder.Columns(true))
    .Editable(editable => editable.Mode(GridEditMode.InCell))
    .Resizable(resize => resize.Columns(true))
    .DataSource(dataSource => dataSource
        .Ajax()
        .Model(model =>
            {
                model.Id(p => p.ID);
                model.Field(p => p.ID).Editable(false);
            })
            .PageSize(20)
            
        .Read(read => read.Action("GetMilestonesJson", "Kendo")))
    )

Controller:
        public ActionResult GetMilestonesJson()
        {
            Milestone viewModel = new Milestone();
            viewModel.Milestones = new QuerySvc.QuerySvcClient().GetMilestones(this.xLMContext.Worker, null);
            var kendoResult = new DataSourceResult()
            {
                Data = viewModel.Milestones.Select(p => new { ID = p.ID, Name = p.Name, Sequence = p.Sequence, TemplateType = p.TemplateType }),
                Total = viewModel.Milestones.Count()
            };


            return Json(kendoResult);
        }
Chih-Yu
Top achievements
Rank 1
 answered on 07 Aug 2012
1 answer
281 views
hi all,
i was wondering how to make the dropdownlist update its data like in Telerik MVC.

// Gets the ComboBox
var drop = $("#Parent").data("tComboBox");
// Reload the ComboBox data
drop.reload();
Thanks in advance Mohammed Adel
Vesselin Obreshkov
Top achievements
Rank 2
 answered on 06 Aug 2012
2 answers
235 views

Hi

I´m using MVC3 + Razor + Telerik and I have a Grid where the method Edit, update, Insert and Delete doesn´t work.

For example in Update after de Wiew layer the way is

 

1.- On the controllers

 

public ViewResult Index()

     return View(db.SYS_UF.ToList());

 

 

 

2.- @{

    Layout = "~/Views/Shared/_Layout.cshtml";

}

 

 

 

3.- Index.cshtml

 

   @{

       GridButtonType type = GridButtonType.Image;

       GridEditMode mode = GridEditMode.InLine ;

   }

 

   @{

       ViewBag.Title = "Lista de UFs";

   }

 

...

... and On to build the screen

 

 

Have any bory some example ?

 

Thanks A lot.


 

 

 

 

 

 

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using STC_WEB.Models;
using Telerik.Web.Mvc;
using STC_WEB.Controllers.ClassesGrid;

namespace STC_WEB.Controllers
{
    public class UFController : Controller
    {
        private AGRELENSEEntities db = new AGRELENSEEntities();

        /****************************************************************/
        //Used for the Ajax binding
        [GridAction]
        public ActionResult _SelectAjaxEditing()
        {
            List<SYS_UF> lstP = UFGrid.All();
             return View(new GridModel { Data = lstP });
            //return View(new GridModel(PagamentoGrid.All()));
        }

        [AcceptVerbs(HttpVerbs.Post)]
        [GridAction]
        public ActionResult _InsertAjaxEditing(int id)
        {
            //Create a new instance of the EditableProduct class.           
            SYS_UF uf = new SYS_UF();
            //Perform model binding (fill the product properties and validate it).           
            if (TryUpdateModel(uf))
               {
                  uf.SYS_UF_CD = Convert.ToString(id);
                  UFGrid.Insert(uf);
               }
            List<SYS_UF> lstP = UFGrid.All();
            return View(new GridModel { Data = lstP});
        }

        [AcceptVerbs(HttpVerbs.Post)]
        [GridAction]
        public ActionResult _SaveAjaxEditing(int id)
        {
            SYS_UF uf = UFGrid.One(p => Convert.ToInt32(p.SYS_UF_CD)  == id);
           
            TryUpdateModel(uf);
            UFGrid.Update(uf);
            List<SYS_UF> lstP = UFGrid.All();
            return View(new GridModel { Data = lstP });
           
         }

        [AcceptVerbs(HttpVerbs.Post)]
        [GridAction]
        public ActionResult _DeleteAjaxEditing(int id)
        {
            //Find a customer with ProductID equal to the id action parameter
            SYS_UF uf = UFGrid.One(p => Convert.ToInt32(p.SYS_UF_CD) == id);
            if (uf != null)
            {
                //Delete the record               
                UFGrid.Delete(uf);
            }
    
            List<SYS_UF> lstP = UFGrid.All();
 
            return View(new GridModel { Data = lstP });
        }

        /****************************************************************/
        /****************************************************************/

        // GET: /UF/

        public ViewResult Index()
        {
            return View(db.SYS_UF.ToList());
        }

        // GET: /UF/Details/5

        public ViewResult Details(string id)
        {
            SYS_UF sys_uf = (from uf in db.SYS_UF where uf.SYS_UF_CD == id select uf).First();
            return View(sys_uf);
        }

        //
        // GET: /UF/Create

        public ActionResult Create()
        {
            return View();
        }

        // POST: /UF/Create

        [HttpPost]
        public ActionResult Create(SYS_UF sys_uf)    // Create([Bind(Exclude="id")]SYS_UF sys_uf) - qdo houver chave Autoincrementada
        {

            try
            {
                if (!ModelState.IsValid)
                    return View();

                db.SYS_UF.Add(sys_uf);
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            catch
            {
                return View(sys_uf);
            }
        }

        //
        // GET: /UF/Edit/5

        public ActionResult Edit(string id)
        {
            var sys_uf = (from uf in db.SYS_UF where uf.SYS_UF_CD == id select uf).First();
            return View(sys_uf);

       }

        //
        // POST: /UF/Edit/5

        [HttpPost]
        public ActionResult Edit(SYS_UF sys_uf)
        {
            try
            {
                //TODO: add update logic here
                if (ModelState.IsValid)
                {
                    db.Entry(sys_uf).State = EntityState.Modified;
                    db.SaveChanges();
                    return RedirectToAction("Index");
                }
                return View(sys_uf);

            }
            catch
            {
                return View();
            }
        }

        //
        // GET: /UF/Delete/5

        public ActionResult Delete(string id)
        {
            var sys_uf = (from uf in db.SYS_UF where uf.SYS_UF_CD == id select uf).First();
            return View(sys_uf);
        }

        //
        // POST: /UF/Delete/5

        [HttpPost, ActionName("Delete")]
        public ActionResult DeleteConfirmed(string id)
        {
            SYS_UF sys_uf = db.SYS_UF.Find(id);
            db.SYS_UF.Remove(sys_uf);
            db.SaveChanges();
            return RedirectToAction("Index");
        }

        protected override void Dispose(bool disposing)
        {
            db.Dispose();
            base.Dispose(disposing);
        }
 
    }
}

@model STC_WEB.Models.SYS_UF

@{
    ViewBag.Title = "Inclusão de uma nova UF";
}


-* Create.cshtml *-
<h2>Inserir nova UF</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()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend></legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.SYS_UF_CD)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.SYS_UF_CD)
            @Html.ValidationMessageFor(model => model.SYS_UF_CD)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.SYS_UF_DESC)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.SYS_UF_DESC)
            @Html.ValidationMessageFor(model => model.SYS_UF_DESC)
        </div>

        <p>
            <input type="submit" value="Incluir" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Voltar para a Lista", "Index")
</div>

@model STC_WEB.Models.SYS_UF

@{
    ViewBag.Title = "Exclusão de UF";
}

-* Dele.cshtml *-
<h2>Exclusão</h2>

<h3>Você deseja Excluir?</h3>
<fieldset>
    <legend></legend>

    <div class="display-label">UF</div>
    <div class="display-field"><b>
        @Html.DisplayFor(model => model.SYS_UF_CD)
    </b></div>

    <div class="display-label">DESCRIÇÃO</div>
    <div class="display-field"><b>
        @Html.DisplayFor(model => model.SYS_UF_DESC)
    </b></div>
</fieldset>
@using (Html.BeginForm()) {
    <p>
        <input type="submit" value="Excluir" /> |
        @Html.ActionLink("Voltar para a Lista", "Index")
    </p>
}


 

@model STC_WEB.Models.

 

SYS_UF

 

 

 

 

 

@{

ViewBag.Title =

 

"Alterar";

 

}

 

 

 

-* Edit.cshtml *-   (UPDATE)
<

 

 

h2>Edit</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()) {

 

@Html.ValidationSummary(

 

true)

 

 

 

<fieldset>

 

 

 

 

 

 

 

<legend>Cadastro de UFs</legend>

 

 

 

 

 

 

 

<div class="editor-label">

 

 

 

 

 

@Html.LabelFor(model => model.SYS_UF_CD)

 

 

</div>

 

 

 

 

 

 

 

<div class="editor-field">

 

 

 

 

 

@Html.EditorFor(model => model.SYS_UF_CD)

@Html.ValidationMessageFor(model => model.SYS_UF_CD)

 

 

</div>

 

 

 

 

 

 

 

<div class="editor-label">

 

 

 

 

 

@Html.LabelFor(model => model.SYS_UF_DESC)

 

 

</div>

 

 

 

 

 

 

 

<div class="editor-field">

 

 

 

 

 

@Html.EditorFor(model => model.SYS_UF_DESC)

@Html.ValidationMessageFor(model => model.SYS_UF_DESC)

 

 

</div>

 

 

 

 

 

 

 

<p>

 

 

 

 

 

 

 

<input type="submit" value="Gravar" />

 

 

 

 

 

 

 

</p>

 

 

 

 

 

 

 

</fieldset>

 

 

 

 

 

}

 

 

 

<

 

 

div>

 

 

 

 

 

@Html.ActionLink(

 

"Voltar para a Lista", "Index")

 

 

 

 

</

 

 

div>

 

 

 

 


And On.

JORGE
Top achievements
Rank 1
 answered on 06 Aug 2012
1 answer
255 views
Hi,
My Popup Issue

 @(Html.Kendo().Window()
        .Name("roleRightsWindow")
        .Width(600)
        .Height(500)
        .Title("Rights List")
        .Actions(actions => actions.Close())
        .Visible(false)
        .Modal(true)
.LoadContentFrom("_DARoleRightsAssignedAllForPopUp", "DataAccess", new { roleId = 4, roleTypeId = 1 })
)
The above works just fine upon page load (for basic testing), but I want to call the same controller and action but with various values for the parameters gotten from one column in a grid and upon a button click of another column in the same grid.
I tried to find an example but could not.
Help would certainly be appreciated.
Thanks,
Murph


loi
Top achievements
Rank 1
 answered on 06 Aug 2012
4 answers
1.2K+ views
 Hi,

I am trying to add conditional to bound column on GRID. I saw an example that you showed on conditional column in the past and it didn't help me. In my code It only entered to one conditional only. 
It is Boolean column. for example If I have two rows with one value that is: true and the other is false, I will get to true and It will not entered into the else condition.

Here is my code:

@(Html.Telerik().Grid<CRC.Models.CRC_DB_IsConnected>()

                            .Name("Grid")

                            .Columns(columns =>

                                {

                                    columns.Bound(o => o.Name).Width(200);

                                    columns.Bound(o => o.IsConnected).Width(200);

                                    columns.Bound(o => o.IsConnected).ClientTemplate("<# if( item.IsConnected == true) { #> <img width='16' height='16' alt='Connected' src='" + Url.Content("~/Content/Images/buttonCircle_blank_green.png") + "' /> <# } else {#> <img width='16' height='16' alt='Not Connected' src='" + Url.Content("~/Content/Images/buttonCircle_blank_red.png") + "' /> <# } #>").Title("Is Connected");                                   

                                   

                                })

                                .DataBinding(dataBinding => dataBinding.Ajax().Select("_AjaxBinding""Home"))

                                    .Pageable()

                                    .Sortable()

                                    .Scrollable()

                                    .Groupable()

                                    .Filterable()

                                    )

Ran
Top achievements
Rank 1
 answered on 05 Aug 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
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
ColorPicker
DateRangePicker
Security
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
SegmentedControl
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?