Problem with AllowReorder when using ItemTemplate

14 posts, 1 answers
  1. Roger
    Roger avatar
    40 posts
    Member since:
    May 2008

    Posted 30 Jan 2010 Link to this post

    I have implemented a RadListBox that utilizes the reorder and delete functionality provided by AllowReorder and AllowDelete. It worked fine until I also began to use the ItemTemplate functionality to create list items as hyperlinks (thanks to some fantastic help from Genady in this forum).

     

    When the listbox first appears, everything is fine. The list items are hyperlinks. If I click off to the side of one of the list items (so the hyperlink is not fired, but the item is selected), and then click either the Move Up or the Move Down button, the item is moved up or down as it should be but, an additional item, with the same name, is added to the list and it is NOT a hyperlink. So, after the Move up or Move down action I have two instances of the selected item in the list. One is a hyperlink and one is not.

     

    As a work-around, I have been experimenting with using the client-side API to handle the reorder and delete functionalty, per the examples on this site. But, that will open up another can of worms, and I would rather avoid doing that.

    Has anyone else experienced problems with AllowReorder when using an ItemTemplate to customize the display?

    Thanks for any advice you can give.

    UPDATE: I used the onClientReordered event to trap the event in an attempt to remove the "additional", non-hyperlink item that was
    "added" to the list. When I did this, both items were removed from the list. So, I think that an item wasn't actually added when the Move UP or Move Down buttons are used but, the single item is displaying regular text along with the hyperlink after it is moved in the list. I thought this might be helpful information.

  2. Joshua Holt
    Joshua Holt avatar
    23 posts
    Member since:
    Jan 2010

    Posted 02 Feb 2010 Link to this post

    Hi Roger,
    I was unable to recreate this issue.  I created a listbox, bound to a SqlDataSource, created an item template with a link, and turned on reorder/delete, and it functioned as expected.  Do you think you could post a code snippet, or a small project demonstrating the issue?  If it is easier i can get you my simple project, and have you recreate the issue using it.

    Thank you,
    Joshua Holt
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Roger
    Roger avatar
    40 posts
    Member since:
    May 2008

    Posted 02 Feb 2010 Link to this post

    Thank you for your response.

    Genady provided an example using a list box and itemtemplate in response to a thread I started here:
    http://www.telerik.com/community/forums/aspnet-ajax/listbox/need-advice-on-implementing-an-editable-list.aspx

    If you download the example (radlistboxtest.zip) Genady provided in the second post of that thread, and change the declaration of the radlistbox in Default2.aspx to include AllowReorder="true" and AllowDelete="true", then you will see the behavior I am describing.

    The listbox loads perfectly but, if you select a list item and click one of the re-order buttons, the item is reordered appropriately but, its text is listed twice; once as regular text and once as a hyperlink (per the template).

    The case I have in my actual project is slightly more complicated because I am creating the list box from within and xsl transformation but, the behavior is the same. If I can get it to work in this simplified example, I am sure I can get it to work from within the xslt.

    Thanks very much for your help.



  5. Joshua Holt
    Joshua Holt avatar
    23 posts
    Member since:
    Jan 2010

    Posted 02 Feb 2010 Link to this post

    Hi Roger,
    I have just download the example Genady provided, and changed the 2 properties as you explained.  I was still not able to recreate the issue you are encountering.  What version of the controls are you using? 

    Thank you,
    Joshua Holt
  6. Roger
    Roger avatar
    40 posts
    Member since:
    May 2008

    Posted 02 Feb 2010 Link to this post

    I am using RadControls for ASP.NET AJAX Q3 2009. [Both the example project and my actual project point to Bin35/Telerik.Web.UI.dll]

    Thanks again for you willingness to look into this.

    I have tried to upload screen shots (png files, about 35k each) but can't seem to do that. I have tried doing it with IE and with Firefox.

    Maybe I am just loosing my mind! ;-)
  7. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 04 Feb 2010 Link to this post

    Hello guys,

    I have managed to reproduce the issue. It is really strange, it seems to appear only when the item template is being set from the codebehind. However, since the client side reorder does not involve postbacks I can hardly believe that this is the reason. We will research the problem and will write a follow up to you as soon as we find out what is going wrong.

    Regards,
    Genady Sergeev
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  8. Answer
    Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 04 Feb 2010 Link to this post

    Hi Roger,

    We have found the problem.  It was not bug in the listbox but in the way I was attaching the templates in the sample project. When template is applied from the codebehind, the items should also be applied from the codebehind. Moreover, the template should applied to the items in the Page_Init event, not in Page_Load. I have attached my modified sample as an attachment.

    Kind regards,
    Genady Sergeev
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  9. Roger
    Roger avatar
    40 posts
    Member since:
    May 2008

    Posted 04 Feb 2010 Link to this post

    Thank you all for your hard work on this.

    I will take a look at your new sample, and determine how to apply its lessons to my application (creating the listbox from within xslt).

    Thanks again for your response and your attention to this.

    Best Regards
    Roger.
  10. Roger
    Roger avatar
    40 posts
    Member since:
    May 2008

    Posted 05 Feb 2010 Link to this post

    OK, I can't imagine why, but I get the same behavior in this example as well.

    I give up.

    I think I am going to try some other way of accomplishing this.

    Thanks very much for your help.
  11. Andreas Kaech
    Andreas Kaech avatar
    121 posts
    Member since:
    Sep 2004

    Posted 13 Apr 2010 Link to this post

    Hi Telerik,
    it's interesting, that you can't recreate this issue.
    After reordering (my template is inline) the reordered item occurs twice:
    <span class="rlbTemplate">                                                      
    <id="lstLinks_i1_HyperLink1" href="%3Ca%20href=%22http://www.google.com%22%20target=%22_blank%22%3Ehttp://www.google.com%3C/a%3E" target="_blank"></a> 
    <href="http://www.google.com" target="_blank">http://www.google.com</a> 
    </span> 
    What's wrong here?
    Thanks,
    Andreas
  12. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 15 Apr 2010 Link to this post

    Hi Andreas Kaech,

    This is bug of RadListBox's reorder functionality which we are aware of. I am happy to announce that the bug is already fixed. You can verify this on the Q1 Service Pack 1 which is going to be released by the end of the week.

    Greetings,
    Genady Sergeev
    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.
  13. J
    J avatar
    4 posts
    Member since:
    Oct 2009

    Posted 01 Jul 2010 Link to this post

    I have downloaded the Telerik.Web.UI_2010_1_630_Dev_hotfix.zip and this issue is still happening, though it did not say it was fixed in the release notes, what download should I be using?

    Thanks
  14. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 02 Jul 2010 Link to this post

    Hello Jonathon Twigg,

    The issue is going to be resolved for the upcoming Q2 release. The Q2 release is scheduled for the middle of July. Meanwhile you can use the following workaround, please paste the following code right after your ScriptManager delaration:

    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>

    <script type="text/javascript">
            Telerik.Web.UI.RadListBoxItem.prototype._render = function(html) {
                var listBox = this.get_listBox();
                this._renderBeginTag(html);
     
                if (this.get_checkable() && listBox._checkBoxes)
                    this._renderCheckBox(html);
     
                if (this.get_imageUrl())
                    this._renderImageElement(html);
     
                if (this._parent && !this._parent._isTemplated)
                    this._renderTextElement(html);
     
                this._renderEndTag(html);
            }
             
        </script>
     
        <telerik:RadListBox runat="server" ID="RadListBox1" AllowReorder="true">
            <Items>
                <telerik:RadListBoxItem Text="Text1" />
                <telerik:RadListBoxItem Text="Text2" />
                <telerik:RadListBoxItem Text="Txet3" />
            </Items>
            <ItemTemplate>
                <%# DataBinder.Eval(Container, "Text") %>
            </ItemTemplate>
        </telerik:RadListBox>

    Again, the issue is going to be resolved for the upcoming release.

    Sincerely yours,
    Genady Sergeev
    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
  15. J
    J avatar
    4 posts
    Member since:
    Oct 2009

    Posted 15 Jul 2010 Link to this post

    I can confirm it has been fixed in the Q2 release.

    Thanks
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017