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

problem finding listview and setting datasource (client side)

1 Answer 16 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Davy
Top achievements
Rank 1
Davy asked on 06 Sep 2013, 08:20 AM
hi there,

i have a problem finding the listview through javascript. it always returns null.
also i get an error on setting datasource : function not known.
i just included the 3 dll's in my bin folder. Serverside was working

javascript:
function pageLoad() {
    var listview = $find("rlvProducts");
    console.log(listview);
    listview.set_dataSource(products);
    listview.dataBind();
}

aspx:
<telerik:RadListView ID="rlvProducts" CssClass="test" runat="server">
                <ClientSettings>
                    <DataBinding ItemPlaceHolderID="iphProducts">
                        <LayoutTemplate>
                            <ul id="iphProducts">

                            </ul>
                        </LayoutTemplate>
                        <ItemTemplate>
                            <li>#= id #</li>
                        </ItemTemplate>
                    </DataBinding>
                </ClientSettings>
            </telerik:RadListView>

also i followed this guide:
http://blogs.telerik.com/aspnet-ajax/posts/12-02-06/client-side-databinding-with-radlistview-for-asp-net-ajax---part-1.aspx

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 11 Sep 2013, 09:36 AM
Hello Davy,

Can you please try to replace '$find("rlvProducts")' with '$find("<%= rlvProducts.ClientID %>")' and see if it solves the issue.

Additionally, attached you can find a simple project with your scenario that works as expected on my side.

For more information about the client ListView object you could take a look at our help article: "Getting RadListView Client Object"

Hope that helps.

 

Regards,
Konstantin Dikov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
ListView
Asked by
Davy
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or