Telerik Forums
UI for ASP.NET MVC Forum
1 answer
274 views
Hi 

I am using Telerik(Product Version 2012.3.1018.340) MVC grid for my project. When I am setting initial Sort configuration with multiple columns, It have an issue with individual column sorting. The individual column sorting is not at all working in my grid

It is working fine if I didn't set initial sort order (ie, if i give just ".sortable()"). But i want to set initial sort order also individual column sort order functionality

I tried with operation mode is client. Then for one time the sorting is happening only for anyone column which we clicked first. Next time when we try to click on any other column to sort it won't work. 

I used the following code in my project, please help me to tackle this issue

view
------

Html.Telerik().Grid<MyApplication.MainApplication.Models.ApplicationModel.ApplicationViewModel>().Name("Grid1")
            .Columns(col =>
            {
                col.Bound(c => c.UserID).ClientTemplate(
                    "<a href='" + Url.Content("~/Index/Details/") + "<#= UserID #>' title='Details' class='lnkDetails'><#= Number #></a>"
                    ).Title("Number").Filterable(false);
                col.Bound(c => c.FirtName).Filterable(false);
                col.Bound(c => c.LastName).Filterable(false);
                col.Bound(c => c.RID).Hidden();
                col.Bound(c => c.Active).Filterable(false).ClientTemplate(
                    "<input type='checkbox'" + "<#= Active?\"checked\":\"\" #>" + " OnClick='return false' />"
                    ).Width(115);
                col.Bound(c => c.StartDate).Filterable(false).Format("{0:d}").Width(115);
                col.Bound(c => c.CloseDate).Filterable(false).Format("{0:d}").Width(112);
                if (currentUser.AdminRole && (currentUser.DataRole || currentUser.StaffRole))
                {
                    col.Bound(c => c.ID).ClientTemplate(
                            "<a href='" + Url.Content("~/Controller/Create/") + "<#= UserID #>' title='New Contact' class='edit'>New Contact</a>"
                            + "<a href='" + Url.Content("~/Controller/Details/") + "<#= UserID #>' title='Details' class='details action-margin'>Edit</a>"
                            + "<a href='" + Url.Content("~/Controller/Delete/") + "<#= UserID #>' title='Delete' class='delete action-margin'>Delete</a>"
                        ).Title("Action").Filterable(false).Sortable(false).Width(90);
                }
                else if(currentUser.AdminRole)
                {
                    col.Bound(c => c.UserID).ClientTemplate(
                            "<a href='" + Url.Content("~/Controller/Details/") + "<#= UserID #>' title='Details' class='details'>Edit</a>"
                            + "<a href='" + Url.Content("~/Controller/Delete/") + "<#= UserID #>' title='Delete' class='delete action-margin'>Delete</a>"
                        ).Title("Action").Filterable(false).Sortable(false).Width(90);
                }              
                else
                {
                    col.Bound(c => c.UserID).ClientTemplate(
                            "<a href='" + Url.Content("~/Controller/Details/") + "<#= UserID #>' title='Details' class='details action-margin'>Edit</a>"
                        ).Title("Action").Filterable(false).Sortable(false).Width(75);
                }
            })
 
                 .DataBinding(dataBinding => dataBinding.Ajax().Select("_Index", "Controller"))                
                 .Pageable(p => p.PageSize(30))                              
                 .Filterable(f => f.Filters(filters =>
                 {
                     filters.Add(c => c.Number).StartsWith((string)ViewData["Number"]);
                     filters.Add(c => c.FirstName).StartsWith((string)ViewData["FirstName"]);
                     filters.Add(c => c.LastName).StartsWith((string)ViewData["LastName"]);
                 }))
                 .Sortable(sorting => sorting
                        .Enabled(false)
                        .SortMode(GrUserIDSortMode.MultipleColumn)
                        .OrderBy(sortOrder =>
                        {
                            sortOrder.Add(o => o.Number);
                            sortOrder.Add(o => o.FirstName);
                            sortOrder.Add(o => o.LastName);                           
                            sortOrder.Add(o => o.Active);
                            sortOrder.Add(o => o.StartDate).Descending();
                            sortOrder.Add(o => o.CloseDate).Descending();
                            sortOrder.Add(o => o.UserID);
                        }))
                .Render();

controller
----------

[GridAction]
public ActionResult _Index()
{
    return View(new GridModel<UserViewModel>
    {
        Data = GetCases().ToList()
    });
}
Rosen
Telerik team
 answered on 14 Jan 2015
3 answers
167 views
Hi,

I want to maintain the state of the tabstrip in database before logout. So that on successful login thereafter the same tabs are getting displayed. Basically i need to maintain the tabs opened in a window. Those tabs might be dynamically added during that particular session. Can someone help me with this.

T. Tsonev
Telerik team
 answered on 14 Jan 2015
1 answer
133 views
Hi,

We have a requirement of implementing charts, so that series points can be adjusted by dragging them.
Here is an example of desired chart behavior: http://jsfiddle.net/highcharts/ZQQpS/2/embedded/result/

I explored Telerik's KendoUI and its MVC wrapper charts but it looks like this feature is not available. Is it? Any help?

Thanks
Iliana Dyankova
Telerik team
 answered on 14 Jan 2015
1 answer
156 views
Hello admin.  I have a problem. When i used the Kendo upload control and i want to get full path of the image in client side then how can i get path of image in kendo upload. I know its security issue but i want to get full path of image. so please suggest me how to do that?
thanks
Dimo
Telerik team
 answered on 14 Jan 2015
1 answer
124 views
Hi all,
I'm building a grid where I group my data by 3 columns, but I show the sum of another column as ClientGroupFooterTemplate. Here some code snippet
Inside data source:
                .Group(gr =>
                    {
                        gr.Add(p=> p.Finality);
                        gr.Add(p=> p.Task);
                        gr.Add(p=> p.Session);
                    }
                )
                .Aggregates(aggr =>
                    {
                        aggr.Add(p => p.Duration).Sum();
                    })

Inside .Columns
//previous columns code
columns.Bound(c => c.Duration).Title("Duration (h)").Width(150).ClientGroupFooterTemplate("Sum: #=sum#");
//following columns code

but when grid displays the data it shows the Sum at the end of every grouping (Finality, Task and Session)
I want to diplay it only for Session, how can I accomplish that?

Daniel
Telerik team
 answered on 13 Jan 2015
4 answers
107 views
Hello,

I want to develop a feature to my application which recognizes what I type and if the typed word is a name then it should take me to link of that person name.

Here is login of my application:
URL: http://shrirangtest3.azurewebsites.net/
login: peter
psswd: erp

Steps:
1. login to above url
2. Go to "Messages" tab under "Home" tab
3.Click on "Add New Message"
4. There is currently html text area called "Content"
5. Now say, I change this html text are to kendo editor and when I type sentence with word like "Peter", then it should show a link and if I click on the link then link should open "http://shrirangtest3.azurewebsites.net/People/Peoples/Edit/4"  (It's in "People" tab)
How can feature given in point# 5 be accomplished?
Will kendo editor help me or should there be any other solution... ?
Your technical inputs will help me

Thanks




Kiril Nikolov
Telerik team
 answered on 12 Jan 2015
1 answer
230 views
Despite my best efforts I cannot make the dates returned from the controller appear as dd/mm/yyyy in the edit popup of my kendo grid. I have [DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}", ApplyFormatInEditMode = true)] above the dates in my model and have even doubled my effort by declaring the date format in the HTML Helper itself. I have tried TextBoxFor(), TextAreaFor(), DisplayFor(), and still the date appears as below. Any help would be appreciated.

Tue Dec 23 2014 00:00:00 GMT-0500 (Eastern Standard Time)
Vladimir Iliev
Telerik team
 answered on 12 Jan 2015
1 answer
214 views
Currently, your treeview checkbox demo does not match the source code included on the page.  The source code indicates there should be a "Find Checked Nodes" button, but your demo doesn't have this.  When I do a View Source, I see that there is an onCheck script to report what has been checked.  

In contrast, in my downloaded local demo source code (I am using MVC Q2 2014 SP2), the Find Checked Nodes button exists, but it doesn't do anything.  I am brand new to MVC .NET and jQuery (with some experience with WebForms), so the inconsistencies make things even harder to understand.

What I WANT to happen is to get the checked values in my HTTPPost controller method, so I can do some database work with the results, but I can't figure out how to get the user checked values there. How can I do this?

My simplified model:
public class MyModel
{
    public string OtherStuff {get; set;}
    public IEnumerable<TreeViewItemModel> treeData { get; set; }
}

My simplified view:
@model MyModel
 
<text>@Model.SomethingElse</text>
 
    @(Html.Kendo().TreeView()
            .Name("treeview-left")                       
            .ExpandAll(true)
            .Checkboxes(checkboxes => checkboxes
                           .Name("checkedPubIds")
                           .CheckChildren(true)                     
                            )           
            .BindTo(Model.treeData)                      
    )


My relevant controller methods:
private MyModel GetMyModel() 
{           
    var model = new PubTreeModel
        {
          OtherStuff = "Hello",               
          treeData = GetTreeData() // implementation omitted here
        };
             
    return model;
}
 
[HttpGet]
public ActionResult Index()
{
    var model = GetMyModel();
    return View(model);
}
 
[HttpPost]
public ActionResult Index(MyModel model)
{
   if (ModelState.IsValid)
   
      // Access Violation, because model.treeData is null.  Why?
      foreach (var x in model.treeData)
      {
        if (x.Checked)
        {      
          // do something
         }
      }
    }
     
    // Have to do this or View(model) will break,
    // because there is no treeData in it.    
    model = GetPubTreeModel(model.SelectedUserId);
     
    return View(model);
}

Petur Subev
Telerik team
 answered on 09 Jan 2015
1 answer
264 views
Is any way to hide calculated column in edit mode?
I have age calculated then grid read ajax data
      Age = (human.Dateofbirth > DateTime.Now.AddYears(-(DateTime.Now.Year - human.Dateofbirth.Value.Year))) ? (DateTime.Now.Year - human.Dateofbirth.Value.Year) - 1 : DateTime.Now.Year - human.Dateofbirth.Value.Year
       
Column shows age in grid but also appears in pop up edit mode

I know I can catch event and dynamically hide icon just wander if grid can aware of calculated column

in model:
        [ReadOnly(true)]
        [Editable(false)]
        [DisplayName("Age")]
        public int Age
        {
            get;
            set;
        }
Petur Subev
Telerik team
 answered on 09 Jan 2015
1 answer
85 views
Hello, I want to ask edit popup editor of Grid. Actually i used editor template and its working. I show my own template on Grid view popup but i want to edit whole grid popup editor. Now i don not have any idea how to do that. So can you give my solution?
Georgi Krustev
Telerik team
 answered on 09 Jan 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?