1

I have a grid which contains an id,which is a hyperlink and takes me to a different page.Can anyone help me to achieve this.

Thanks

user1268906
  • 51
  • 1
  • 7

2 Answers2

3

Assuming that the user is working on Telerik-MVC. Here's a sample code.

 Html.Telerik().Grid(Model)
    .Name("GridName")
    .DataKeys(keys => keys.Add(k => k.Id))
    .Columns(columns =>
    {
        columns.Bound(c => c.Id).Title("ID")
            .Template(@<text><a href="http://differentpage?id=@item.RpoId">@item.RpoId</a> </text>);
            columns.Bound(c => c.PropertyA);
            columns.Bound(c => c.PropertyB); //And so on...
        }

    )
    .Render();

Have a closer look at how the column is Templated.

Uchitha
  • 998
  • 8
  • 24
  • Actually, I'd use the "ClientTemplate" method instead of the "Template" one. Ultimately you have the right answer. Unfortunately for you the question's author probably wont come back to "accepted". – Zwik Mar 26 '12 at 21:19
  • Then I'd presume that you are doing client side data binding as "ClientTemplates" are not intended to be used in pure server side binding. – Uchitha Mar 28 '12 at 08:30
-1

If you're willing to use the RadGrid, then there is a type of column called the GridHyperLinkColumn described here: http://www.telerik.com/help/aspnet-ajax/grid-column-types.html

Using RadGrid with MVC: http://www.telerik.com/help/aspnet-ajax/mvc-radgrid-databinding.html

This example shows what it can look like http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/columntypes/defaultcs.aspx.

If not, you'll need to use a GridColumnTemplate with a link in it.

msigman
  • 4,474
  • 2
  • 20
  • 32