This is a migrated thread and some comments may be shown as answers.

Multiple entries in one column

6 Answers 174 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jim
Top achievements
Rank 1
Jim asked on 02 May 2010, 04:03 PM
I am replacing a table with the MVC grid.  In my table I had an entry for original date and most recent date in a single td.  Is it possible to do the same thing with the grid?

6 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 03 May 2010, 07:12 AM
Hi Jim,

Yest it is possible. You have to use templates to do so. Depending on your binding scenario you can use server templates (if doing server binding) or client templates (if doing ajax or web-service binding):

Server Template:

columns.Bound(o => o.Date1).Title("Dates").Template(o =>
{ %>
        <%= o.Date1 %>
        <%= o.Date2 %>
  <%
});

Client Template:
columns.Bound(o => o.Date1).Title("Dates").ClientTemplate("<#= Date1#> <#= Date2 #>")

Regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Jim
Top achievements
Rank 1
answered on 04 May 2010, 02:16 AM

<
% Html.Telerik()     
       .Grid(Model)     
       .Name("forums")     
       .PrefixUrlParameters(false)     
       .Columns(columns =>    
                {     
 
                    columns.Add(c =>   
                                {     
                                    %>   
                                        <%= Html.ActionLink(c.Title, "ViewPost", new { postId = c.PostId , url = "forums/posts/{postId}/"})%>    
                                          
                                    <%     
                                }).Title("Title").Width(280);     
 
    
                    columns.Add(c => c.ViewCount).Width(20);     
                    columns.Add(c => c.ReplyCount).Width(20);   
                    columns.Add(c => c.AddedBy).Width(100);  
                    //I want these next two column to be in one, much like the forums grid in Telerik support  
                    columns.Add(c => c.LastPostedBy).Width(100);  
                    columns.Add(c => c.LastPostDate).Width(100);  
                })     
        .Filterable()     
        .Sortable(sort => sort.SortMode(GridSortMode.SingleColumn))     
        .Pageable(paging => paging.PageSize(25))     
        .Scrollable(scrolling => scrolling.Height(690))     
        .Render(); %>    
 

Using this grid as an example, I would like to combine the last two columns into a single column.  I'm not sure what you mean by "using a template.  How do I do this?
0
Jim
Top achievements
Rank 1
answered on 04 May 2010, 04:19 AM
I found my problem.  I needed to upgrade to Q1 2010.  Thanks for your help.
0
eqwe
Top achievements
Rank 1
answered on 30 Jun 2010, 12:25 AM
Hi Telerik Team

I had encountered a problem using of the following:

1.)columns.Bound(c => c.registrant_id).Title("Id").Width(130);
                columns.Bound(c => c.firstname).Template(o =>
                { %>
                        <%= o.firstname  %>
                        <%= o.lastname  %>
                  <%
                }).Title("Full Name");


I got this error CS1525: Invalid expression term ')

2.)columns.Bound(o => o.firstname).Title("Full Name").ClientTemplate("<#= firstname#> <#= lastname #>");
 This is not working to me..

Please see attached file error problem.

I really appreciate your help.

Thanks
Greg
















0
Kiang
Top achievements
Rank 1
answered on 24 May 2012, 03:39 AM
hello , Do you have format of Razor type for 


columns.Bound(c => c.registrant_id).Title("Id").Width(130);
                columns.Bound(c => c.firstname).Template(o =>
                { %>
                        <%= o.firstname  %>
                        <%= o.lastname  %>
                  <%
                }).Title("Full Name");
0
Vandana Punjabi
Top achievements
Rank 1
answered on 28 Jul 2012, 08:39 AM
Hi
Telerik Team

How can I merge two templated columns into single column?
I want to show the image icon beside the text depending on certain condtion.

Thanks,
Vandana
Tags
Grid
Asked by
Jim
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Jim
Top achievements
Rank 1
eqwe
Top achievements
Rank 1
Kiang
Top achievements
Rank 1
Vandana Punjabi
Top achievements
Rank 1
Share this question
or