Binding RadListBoxItem

2 posts, 0 answers
  1. David
    David  avatar
    35 posts
    Member since:
    Dec 2008

    Posted 18 Jan 2010 Link to this post

    Hi all,

      I am trying to do a drag and drop shopping cart very similiar to the  http://demos.telerik.com/aspnet-ajax/listbox/examples/functionality/templates/defaultcs.aspx.  I am using Item Templates with a style override of list tag to display inline creating a horizatal layout of products.  




      Currently I am pulling my data of products in using LingtoSql then binding the data with this:
     var db = new Products.ProductsDataContext();  
            var floorthumbs = (from c in db.Floorings  
                               select c);  
     
            RadListBox1.DataSource = skus;  
            RadListBox1.DataBind(); 

      I  tried using <img class="product-image" src='Images/<%# DataBinder.Eval(Container, "Value")%>' /> to bind the image tag.  I ended up dropping DataBinder.Eval to use just Eval to get image to display.

    When I attempt to transfer an item from the Product list to the Detail View & Purchase, the RadListBox2 does not bind the image name. 

    What is the best method to duplicate the example with pulling in live data from a database?
    Is it possible to load to the RadListBoxItem dynamiclly in the code behind?

    Thanks,
    David
  2. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 19 Jan 2010 Link to this post

    Hi David ,

    You need to call the DataBind method of the destination listbox whenever an item is transferred. I suggest that you hook on the OnTransferred server side event and call the destination listbox databind method there. Example code:

    protected void Page_Load(object sender, EventArgs e)
       {
           RadListBox1.DataBind();
           RadListBox1.Transferred += new RadListBoxTransferredEventHandler(RadListBox1_Transferred);
       }
     
       void RadListBox1_Transferred(object sender, RadListBoxTransferredEventArgs e)
       {
           e.DestinationListBox.DataBind();
       }


    Sincerely yours,
    Genady Sergeev
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top