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

[Solved] Unbound Column to GridColumnSetting

1 Answer 95 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.
steve_ba14
Top achievements
Rank 1
steve_ba14 asked on 01 Dec 2011, 11:23 AM
Good morning.
I am migrating column definitions across to GridColumnSettings so that they can be re-ordered and  persisted.   We have an edit column , which will take a user to another page. 

What is the best way to translate 

   .Columns(cols => cols.Template(m =>
                                       Html.ActionLink("Edit", "Edit", new { id = m.Id })   )  
                             .ClientTemplate("<a href='/AdminUser/Edit/<#= Id #>'>Edit</a>")
                             .Width(50)     
                             .HtmlAttributes(new { style = "text-align:center", name = "commandCol" })
		)

To a Grid Column Setting ?

Cheers

Steven

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 02 Dec 2011, 04:56 PM
Hi Steven,

I attached a project which uses a column with the same settings except from the Server Template. There is just no way access the Writer in the controller when using the Razor View Engine. If you are using the ASPX engine you could use a code similar to the one in the snippet below to define the Template:

GridColumnSettings<Product> templateSettings = new GridColumnSettings<Product>();
templateSettings.Template = (p) =>
    { Response.Write("<a href='/AdminUser/Edit/" + p.ProductID + "'>Edit</a>"); };



Kind regards,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
Grid
Asked by
steve_ba14
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or