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

Add Edit link in Telerik Grid with Ajax binding

4 Answers 123 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.
Muhamad Tassadaque Zia
Top achievements
Rank 1
Muhamad Tassadaque Zia asked on 28 Apr 2010, 11:37 AM
Hi
I want to add edit link column to my grid. i am using ajax binding. when i run the code first time it shows a anchor tag "<a href="/um/Edit/1">Edit</a>" instead of Edit hyperlink. but when i sort the column it starts showing the "Edit" hyperlink.
Thanks in advance


<% Html.Telerik().Grid(Model) 
        .Name("UserType") 
            .DataBinding(dataBinding => dataBinding 
                //Ajax binding 
 
                .Ajax() 
                //The action method which will return JSON 
                       .Select("_AjaxBinding", "UM") 
 
            ) 
        .Columns(colums => 
            { 
                colums.Bound(o => o.TypeID).Visible(false); 
                colums.Bound(o => o.UserType).Width(30).Filterable(true); 
                colums.Bound(o => o.Description).Width(200).Filterable(false); 
                colums.Bound(o => o.TypeID).Format( 
              %><%Html.ActionLink("Edit", "Edit", new { Id = "{0}" }).ToString()); 
 
            }) 
 
        .Pageable() 
        .Sortable() 
        .Filterable() 
        .Render(); 
         
         
       
         
%> 

4 Answers, 1 is accepted

Sort by
0
Muhamad Tassadaque Zia
Top achievements
Rank 1
answered on 29 Apr 2010, 06:18 AM
Can any one guide me on this issue!
0
Muhamad Tassadaque Zia
Top achievements
Rank 1
answered on 03 May 2010, 11:20 AM
if i see the generated html it gives me the following tag
<td>
text - <a href="/um/Edit/2>Edit</a>
</d>
If someone could guide me about some function which convert anchor tag text string into html tag
0
Robby
Top achievements
Rank 1
answered on 22 Jun 2010, 08:18 AM

Hi, i want to add some review for the code. try this, it's work

columns.Add(c => c.CustomerID).Format( Html.ActionLink("Edit", "Home", new { id = "{0}"}}) ).Encoded(false).Title("Edit");

0
Sebastian S
Top achievements
Rank 1
answered on 23 Jun 2010, 06:24 AM
You want to do this:

               columns.Bound(c => c.CustomerId)
                    .Format(Html.ActionLink("Edit", "Home", new { id = "{0}" }).ToHtmlString());


See:
Changes from Q3 2009 Service Pack 2 (Assembly version 2009.3.1320)
Tags
Grid
Asked by
Muhamad Tassadaque Zia
Top achievements
Rank 1
Answers by
Muhamad Tassadaque Zia
Top achievements
Rank 1
Robby
Top achievements
Rank 1
Sebastian S
Top achievements
Rank 1
Share this question
or