Radlistview not binding correctly during rebind

2 posts, 0 answers
  1. deva sudan
    deva sudan avatar
    9 posts
    Member since:
    Jan 2010

    Posted 20 Oct 2010 Link to this post

    Hello ,

    I'm facing problem with rebinding RADListView from code behind by  changing the databasourceid in the event of RADTreeNode selection.

    I'm desiging a page with Radtreeview and Radlistview and while clicking the node on the RADTreeView I'm getting the directory path from the treenode and assigning the selected directory to the RADListview in the code behind to list all images.  

    Intermittently the RADListView is not getting the correct path and binding to a previously assigned values.  This is happening more frequently.

    I'm displaying the same treenode selected path on a Gridview and that is showing the correct values for that selected treenode consistently.  It seems to be an issue with the RADListview binding using AJAX. 

    Is there an alternate approach I can try to fix this dynamic biding issue?   Thanks for your help.



    protected void RadTreeView1_Selected(object sender, RadTreeNodeEventArgs e)





    if (e.Node.ToolTip == "Album")





    string albpath = "";




    if (RadTreeView1.SelectedNode.GetFullPath("/") == "Sample Folder/Sample Album")





    albpath = "~/" + "Registered_Users_Uploaded_Images" + "/" + RadTreeView1.SelectedNode.GetFullPath("/");





    else {


    albpath =


    "~/" + "Registered_Users_Uploaded_Images" + "/" + uname + "/" + RadTreeView1.SelectedNode.GetFullPath("/");






    "path"].DefaultValue = albpath;




    // ObjectDataSource1.SelectMethod = "GetData()";


    RadAjaxManager1.AjaxSettings.AddAjaxSetting(RadTreeView1, ObjectDataSource1);


    RadListView1.DataSourceID =






    RadAjaxManager1.AjaxSettings.AddAjaxSetting(RadTreeView1, RadListView1);



    ============== ObjectDataSource=============



    <asp:ObjectDataSource runat="server" ID="ObjectDataSource1" SelectMethod="GetData"












    <asp:Parameter Name="path" DefaultValue="~/Registered_Users_Uploaded_Images\dsnap1\My Albums\2010-10-16"/>











    ============ AJAX settings ==================



    <telerik:AjaxSetting AjaxControlID="RadTreeView1">








    <telerik:AjaxUpdatedControl ControlID="GridView1" />




    <telerik:AjaxUpdatedControl ControlID="ObjectDataSource1" />




    <telerik:AjaxUpdatedControl ControlID="RadListView1" LoadingPanelID="ListViewPanel1" />







  2. Tsvetina
    Tsvetina avatar
    2101 posts

    Posted 26 Oct 2010 Link to this post

    Hello Deva,

    Does the ListView bind correctly if you turn AJAX off (set EnableAJAX="False" for the RadAjaxManager)? If not so, it would be a good idea to see if the datasource is assigned at all to the ListView before Rebind() is called. Keep in mind that it is safer to pass the ID of the datasource using its ID property rather than using the string ID that you specified.

    Also, see if calling DataBind() on the ObjectDataSource before assigning it to the ListView makes a change.

    As for the AJAX functionality, are you adding the AJAX settings declaratively or programmatically? It seems you do both, which is possible but you are adding one and the same settings twice. Additionally, if you want to create AJAX setting programmatically, you should always do this in a Page event handler, which is executed each time during the page lifecycle (Page_Load, Page_PreRender) so that the control could be ajaxified when the page is initially loaded.

    All the best,
    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
Back to Top