This is a migrated thread and some comments may be shown as answers.
OnRowDataBound event not getting fired
4 Answers 113 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Anthony
Top achievements
Rank 1
Anthony asked on 13 Apr 2012, 10:41 AM
The onrowdatabound even doesn't fire. I do not get any javascript error either, and I have bound the grid using Ajax databinding. Here is thecode. Please help me as I am majorly stuck on this.
The grid renders correctly though.

Thanks,
Anthony

//Code
 @{                         
    Html.Telerik().Grid(Model.Specialities)
                        .Name("Specialities")
                        .Columns(columns =>
                        {
                            columns.Bound(o => o.ServiceName).Title("Specialty");
                            columns.Bound(o => o.IsAssociatedSpeciality).Title("Associated With Problem")
                            .ClientTemplate("<input type='checkbox' name='associatedSpecialty' <#= IsAssociatedSpeciality ? 'checked' : ''#> />");

                            columns.Bound(o => o.IsCommonDiagnosis).Title("Common Problem")
                           .ClientTemplate("<input type='checkbox' name='commonSpecialty' value='<# IsCommonDiagnosis #>' />");
                        })
                            .DataBinding(dataBinding => dataBinding.Ajax().Select("ManageAssociatedSpecialities", "Diagnosis"))
                        .ClientEvents(events => events.OnRowDataBound("onRowDataBoundSpecialties"))
                    .Footer(false)
                                .Render();
                                }



//Javascript code

function onRowDataBoundSpecialties(e) {
        alert("called");
        if (e.row.cells[1].innerHTML == "true") {
            e.row.cells[1].attr("disabled", false);
            e.row.cells[2].attr("disabled", false);
        }
        else {
            e.row.cells[2].attr("disabled", true);
        }
    }

4 Answers, 1 is accepted

Sort by
0
Pechka
Top achievements
Rank 1
answered on 13 Apr 2012, 10:56 AM
Hello

Your initial load is performed on the server - this is why the event is not triggered.
Remove the collection passed to the constructor if you want the RowDataBound event to be fired.
0
Anthony
Top achievements
Rank 1
answered on 16 Apr 2012, 09:48 AM
Thank you very much.
That worked :)
0
Manjula
Top achievements
Rank 1
answered on 28 Jun 2012, 11:56 AM
Pechka

Can you be specific.i am facing the same issue .
javascript for OnRowDataBound is not getting Invoked.
find below the code.

@{Html.Telerik().Grid(Model.EnrollmentTemplates)

.Name(

 

"Grid")

 

.ClientEvents(e => e.OnRowDataBound(

 

"Grid_onRowDataBound"))

 

.Columns(columns =>

{

columns.Bound(m => m.TemplateName);

columns.Bound(m => m.Dealer_Count);

columns.Bound(m => m.UpdateDateTime);

columns.Bound(m => m.UpdateUser);

columns.Bound(m => m.EnrollmentTemplateId).Title(

 

"Action(s)");

 

})

 

 

 

 

 

.Pageable()

.Sortable()

.Footer(

 

true)

 

.Filterable()

.Render();

}

 

function

 

 

Grid_onRowDataBound(e)

 

{

alert(

 

"HI");

 

}

 

 

</script>

 

 

 



0
Pechka
Top achievements
Rank 1
answered on 28 Jun 2012, 01:30 PM
Hi mate,

What I mean is to change your Grid declaration like this:

@{Html.Telerik().Grid<YourModelType>()

.Name("Grd")
//...

Tags
Grid
Asked by
Anthony
Top achievements
Rank 1
Answers by
Pechka
Top achievements
Rank 1
Anthony
Top achievements
Rank 1
Manjula
Top achievements
Rank 1
Share this question
or