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

HeaderTemplate in GridColumnSettings

2 Answers 68 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.
Jerry
Top achievements
Rank 1
Jerry asked on 07 Feb 2012, 05:33 AM
Hi, i have a question regarding having a HeaderTemplate field on the controller.

Currently i am trying to have a user preference saved grid with the leftmost column having checkboxes and with the header having a check box option to select all the rows. As shown on the example here "http://demos.telerik.com/aspnet-mvc/grid/headerfootertemplates"

However i dont know how i can implement this correctly using my style. The code is as follows:

                new GridColumnSettings
                {
                    Member = "TimesheetId",
                    Title="checkAllRecords",
                    Width="35px",                    
                    ClientTemplate="<input type='checkbox' id='checkedTimesheet' name='checkedTimesheet' value='<#= TimesheetId #>' />",
                    
//////////////////////////// This is what i am trying to input //////////////////////////////////////
                    HeaderTemplate = "<input type='checkbox' title='check all records' id = 'checkAllRecords'>",
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                    HtmlAttributes = {{ "style", "text-align:center;" }, {"class", "timeTooltip"}}
                    //FooterHtmlAttributes="sdff"
                },

Any help would be appreciated on how to add HeaderTemplates to GridColumnSettings.


Thanks 

2 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 09 Feb 2012, 04:50 PM
Hello Jerry,

Setting server side templates is not supported from the controller as there is no way to output HTML from there. MVC does not allow access to the view from the controller.

All the best,
Daniel
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Deepika
Top achievements
Rank 1
answered on 08 Jun 2013, 11:59 AM
Hi daniel,

I also have the same requirement to add the columns runtime from controller having footer template.

Does telerik mvc grid supports this feature now?

Also can we have frozen columns property so we can set some columns for freeze.
As we have around 20 columns.

Please reply.

Tags
Grid
Asked by
Jerry
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Deepika
Top achievements
Rank 1
Share this question
or