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

[Solved] Client template for Ajax editing in grid not working

7 Answers 339 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.
harshada patil
Top achievements
Rank 1
harshada patil asked on 11 Mar 2010, 12:25 PM
Hello,
      I am using Client Template for Ajax editing in grid, client template is not displayed on page, it will display only after some action occures like- Update, Cancel .
I want to display client template at page load.



Thanks

7 Answers, 1 is accepted

Sort by
0
Marco
Top achievements
Rank 1
answered on 12 Mar 2010, 11:54 AM
Hello Harchada Patil.

What do you really want to do whit client template?

I'm using it in display template and editor template for formating columns as i need.

Unfortunly i have a problem: on ajax binding the display template is not called after some action in grid. 

i mean, it works great on the load of page, but on ajax responses the display template is not called. 

previously i was using client template so if you have problems implementing this please explain yourself better an post your code here to see if I or someone can help.

Best Regards


0
Pradeep N
Top achievements
Rank 1
answered on 26 Apr 2010, 03:45 PM
Hi,
I have got the same problem is this an issue????
Edit hyper link displayed only after an ajax post like filter clear or clicking on the refresh image. It is not displaying on the load.

 <%= Html.Telerik().Grid(Model) 
        .Name("BillingAddressList") 
        .Columns(colums => 
        { 
            colums.Bound(o => o.BillingName); 
            colums.Bound(o => o.Address1); 
            colums.Bound(o => o.Address2); 
            colums.Bound( o => o.City ); 
            colums.Bound( o => o.State ); 
            colums.Bound( o => o.Country ); 
            colums.Bound( o => o.Zip ); 
            colums.Bound( o => o.LastUpdate ); 
            colums.Bound( o => o.Phone ); 
            colums.Bound(o => o.AccountId) 
                .ClientTemplate("<a href='"+ Url.Content("~/Members/Billing/Edit/") + "<#= AccountId #>/"+"<#= BillingName #>'>Edit</a>").Title("Edit"); 
             
        }) 
        .DataBinding( dataBinding => dataBinding.Ajax().Select("Ajax_Index","Billing",new{id = Model.ToList()[0].AccountId})) 
        .Scrollable() 
        .Sortable() 
        .Pageable() 
        .Filterable() 
        .Groupable() 
    %> 
0
kobo33
Top achievements
Rank 1
answered on 23 May 2010, 02:23 PM
Same problem here, any solutions ?
0
Georgi Krustev
Telerik team
answered on 24 May 2010, 09:08 AM
Hi Pradeep N,

The behavior, which you described is expected. If you set ClientTemplate it will be applied when Ajax binding is used. In other words, on initial load the grid is bind server side and then on any other action the Ajax binding is used. Hence the ClientTemplate will not be visible on initial load. To avoid this behavior I will suggest you use only Ajax binding.

Best wishes,
Georgi Krustev
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
Troy Demet
Top achievements
Rank 2
answered on 11 Apr 2011, 08:31 PM
How do I use only AJAX binding.
@ModelType IEnumerable(Of ClientSites30.ViewModels.WebsiteGridViewModel)
@Html.Telerik.Grid(Model) _    
    .Name(
"WebsiteGrid") _    
    .ToolBar(
Function(commands) _        
        commands.Insert().ButtonType(GridButtonType.ImageAndText)) _    
    .DataKeys(
Function(keys) { _
        keys.Add(
Function(c) c.ID)}) _
    .DataBinding(
Function(dataBinding) _
        dataBinding.Ajax().
Select("_AjaxBinding", "Website") _
        .Insert(
"_AjaxCreate", "Website", New With {.clientID = CInt(ViewData("ClientID"))}) _
        .Update(
"_AjaxEdit", "Website") _
        .Delete(
"_AjaxDelete", "Website")) _
    .Columns(
Function(columns) { _
        columns.Bound(
Function(c) c.Domain).ClientTemplate("<a href=""http://<;#= Domain #>"" alt='<#= Domain #>' target=""_blank""><#= Domain #></a>"), _
        columns.Bound(
Function(c) c.Active), _
        columns.Bound(
Function(w) w.IsDnn), _
        columns.Bound(
Function(w) w.RegistrarName), _
        columns.Bound(
Function(w) w.RegistrarURL), _
        columns.Bound(
Function(w) w.RegistrarUserName), _
        columns.Bound(
Function(w) w.RegistrarPassword), _
        columns.Command(
Function(commands) { _
            commands.Edit().ButtonType(GridButtonType.Image), _
            commands.Delete().ButtonType(GridButtonType.Image)}).Width(100)}) _
    .Pageable() _
    .Editable(
Function(editing) editing.Mode(GridEditMode.PopUp))
And the Controller is
<GridAction()> _
       Function _AjaxBinding(ByVal id As Integer) As ActionResult
           ViewData("ClientID") = id
           Dim websites As IQueryable(Of WebsiteGridViewModel) = From w In db.Websites
           Where w.ClientID = id
           Select New WebsiteGridViewModel With {.Active = w.Active, .Domain = w.Domain, .ID = w.ID, .IsDnn = w.IsDNN, .RegistrarName = w.RegistrarName, .RegistrarPassword = w.RegistrarPassword, .RegistrarURL = w.RegistrarURL, .RegistrarUserName = w.RegistrarUserName}
           Return View(New GridModel(websites.ToList))
       End Function
0
Deepthi
Top achievements
Rank 1
answered on 18 Jul 2011, 09:59 AM
Hi,
 Is there a solution to this problem. How can we make the client template visible at page load. By pure ajax binding you mean that we should not bing model to a grid. In that case at page load my grid is empty and is populated when i do a refresh. i want to use client template and at the same time show teh data in grid at page load. One of teh column should display a button. Is this possible? Please could any body let me know on this???

0
Deepthi
Top achievements
Rank 1
answered on 18 Jul 2011, 10:20 AM
Hi,
 Is there a solution to this problem. How can we make the client template visible at page load. By pure ajax binding you mean that we should not bing model to a grid. In that case at page load my grid is empty and is populated when i do a refresh. i want to use client template and at the same time show teh data in grid at page load. One of teh column should display a button. Is this possible? Please could any body let me know on this???

Tags
Grid
Asked by
harshada patil
Top achievements
Rank 1
Answers by
Marco
Top achievements
Rank 1
Pradeep N
Top achievements
Rank 1
kobo33
Top achievements
Rank 1
Georgi Krustev
Telerik team
Troy Demet
Top achievements
Rank 2
Deepthi
Top achievements
Rank 1
Share this question
or