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

Problem with onDataBinding(e) and onRowDataBound(e)

3 Answers 139 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.
Kaleem Khan
Top achievements
Rank 1
Kaleem Khan asked on 23 Dec 2009, 05:13 PM
I have a grid like this:

Html.Telerik().Grid<FuseTalk.Core.Domain.Category>(Model)                                                   
                                                    .Name("Grid")                                                   
                                                    .HtmlAttributes(new { style = "width:100%; font-size:8pt", id = "commGrid" })
                                                    .RowAction(row => { row.HtmlAttributes.Add("class", "communityRow");
                                                                        row.HtmlAttributes.Add("id", row.DataItem.ID );
                                                                      }
                                                               )                                                   
                                                    .Columns(columns =>
                                                                      {
                                                                          columns.Add(c =>
                                                                                          {%><img src="<%=Url.Content("../../../Content/Images/folder_closed.png") %>" />
                                                                                             <%=Html.ActionLink(c.Description, "Index", "Home", new { id = c.ID }, null)%>
                                                                                           <% }
                                                                                      ).Width(200)
                                                                                      .Title("Description");                                                                         
                                                                          columns.Add(c =>
                                                                                          {%><img src="<%=Url.Content("../../../Content/Images/feed-icon.gif") %>"/>
                                                                                           <%
}
                                                                                      )
                                                                                       .Title("Feed");
                                                                          columns.Add(c => c.CategoryStatistics.TopicCount).Title("Topics");
                                                                          columns.Add(c => c.CategoryStatistics.LastMessageDate).Title("Last Post");
                                                                      }
                                                            )
                                                     .ClientEvents(events => events.OnLoad("onLoad").OnDataBinding("onDataBinding").OnRowDataBound("onRowDataBound"))
                                                    .Sortable()
                            .Scrollable(scrolling => scrolling.Height(200))
                            .Pageable()
                            .Render()


and then I defined handlers:

<script type="text/javascript">

    function onLoad(e) { $('ul#editMenu').prepend("<li style='text-align:center; font-weight: bold;'>" + 'Forum options...' + "</li>"); }
    function onDataBinding(e) { alert("onDataBinding"); }
    function onRowDataBound(e) {alert("onRowDataBound");  var dataItem = e.dataItem; }
   
</script>

onLoad handler is called but code in onDataBinding and onRowDataBound is not executed. With IE-8 debugger, the break points are not hit whereas it breaks in event handler for onLoad. If I omit the onDataBinding(e) and onRowDataBound(e) event handler altogether then I get exception.

3 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 24 Dec 2009, 04:35 PM
Hello Kaleem Khan,

This is strange as your configuration seems ok. A similar setup works as expected in our online demo. Do you see any JavaScript errors?

Regards,
Atanas Korchev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Kaleem Khan
Top achievements
Rank 1
answered on 28 Dec 2009, 02:10 AM
No there are no JS errors.
0
Atanas Korchev
Telerik team
answered on 28 Dec 2009, 11:47 AM
Hello Kaleem Khan,

The problem is that your grid is configured for server-side binding. This is why those client-side events are not fired. You should use either ajax or web service binding. When you configure the grid appropriately the events would fire as expected.

Regards,
Atanas Korchev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Kaleem Khan
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Kaleem Khan
Top achievements
Rank 1
Share this question
or