Empty Item Feature Request

8 posts, 0 answers
  1. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 21 Jul 2011 Link to this post

    Checking in on this request....is it in Q2 by any chance?

    Property of something like "InsertEmptyItemOnDataBind"...so I wouldn't have to keep handling OnDataBound to add a empty\null item to the top of the list in every combobox?

  2. Thad
    Thad avatar
    106 posts
    Member since:
    Sep 2010

    Posted 21 Jul 2011 Link to this post

    Hi Steve,

    I'm pretty sure this is not in the Q2 release, but this is how I have gotten around this problem.  Like you, I don't like having to hard code a default item into the markup each time I put a RadComboBox on a page.

    namespace SampleApp.ServerControls
    {
     
        /// <summary>
        /// Normal RadComboBox with support for a default item to be added when databound
        /// </summary>
        public sealed class RadComboBoxWithDefault : RadComboBox
        {
            public string DefaultItemText { get; set; }
            public string DefaultItemValue { get; set; }
     
            /// <summary>
            /// Insert a default item when data bound
            /// </summary>
            /// <param name="e"></param>
            protected override void OnDataBound(EventArgs e)
            {
                base.OnDataBound(e);
                var defaultText = String.IsNullOrEmpty(DefaultItemText) ? "Select..." : DefaultItemText;
                var defaultValue = String.IsNullOrEmpty(DefaultItemValue) ? "-1" : DefaultItemValue;
                Items.Insert(0, new RadComboBoxItem(defaultText, defaultValue));
            }
        }
    }

    Then I just add this control to the page instead and voila!!

    <uc:RadComboBoxWithDefault id="rcbSample" runat="server" DefaultItemText="Select a country..." DefaultItemValue="-1">

    Hope that helps you or someone else.
    -Thad
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 21 Jul 2011 Link to this post

    Hey Thad,
      Yeah that's a good workaround at the moment :)  ...I'll probably impliment this today instead of the multiple DataBound events....Did not occur to me to just do a simple usercontrol wrapper.

    it's a pretty important (basic) feature would you not agree?....I guess it gets more complicated with webservice binding...but an empty item I use 85% of the time when using RadCombo.

    Now @Telerik...please still impliment this as a feature please :)  Just becasue we have a functional workaround doesn't mean it's not a feature people would want...and perhaps I would argue that since people ARE making wrappers\workarounds that should raise some sort of flag?

    Steve
  5. Thad
    Thad avatar
    106 posts
    Member since:
    Sep 2010

    Posted 21 Jul 2011 Link to this post

    Hi Steve,

    We use the server control approach for several different scenarios where we want different common implementations of the RadComboBox.  It is very useful.

    I'm hard pressed to say that this should be cooked into the base control.  It would definitely be handy to have, but I have to say I'd probably still wrap the base RadComboBox in a server control because we utilize this method to enforce site standards like MaxHeight and EmptyMessage, remove animation because it slows down the users' experience, and provide standard binding, validation, and inspection methods.

    I'd rather that Telerik work on features that we have no work around for, like further enhancing the CheckBoxes property support so that the Text propery isn't read-only, or expanding on the clientside API of the RadListView so that we can have an API like the RadGrid where we can easily iterate the items and find controls without writing tons of jQuery.  Better yet, separating out the RadComboBox into two controls -- one with CheckBoxes and one without would make me happy because then each control could be as lean as possible while still sharing a common base class.  But that's just me.  :-)

    I think I saw someone else suggest this same feature over in PITS, so hopefully this will get implemented for you!

    Regards,
    Thad
  6. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 27 Jul 2011 Link to this post

    Hi guys,

    @Steve We have this feature logged in our PITS and we will implement it in the near future. I hope this is good news for you.

    @Thad Thank you for the feedback. Could you please elaborate more on the Text issue when CheckBoxes are enabled? How will you use this custom text?

    Regards,
    Simon
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  7. Thad
    Thad avatar
    106 posts
    Member since:
    Sep 2010

    Posted 27 Jul 2011 Link to this post

    Hi Simon,

    Thanks for the response.  Here is a forum post that explains what I need to be able to accomplish:
    http://www.telerik.com/community/forums/aspnet-ajax/combobox/setting-text-via-javascript-when-checkboxes-true.aspx

    And good news for you, Steve!!

    Thad
  8. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 27 Jul 2011 Link to this post

    It is indeed!...I have a party scheduled for friday :D
  9. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 28 Jul 2011 Link to this post

    Hello again guys,

    @Steve Awesome. Have a great time :)

    @Thad Thank you for the reference. I see what you are having difficulties with and since Kalina already has responded to your questions I do not have anything to add.

    Regards,
    Simon
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

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