Add Button Automatically Disabled

10 posts, 1 answers
  1. Matt Leeds
    Matt Leeds avatar
    12 posts
    Member since:
    Apr 2010

    Posted 09 May 2011 Link to this post

    I have a custom template on a SilverLight Rad Data Form.  It utilizes the attribute "ItemsSource" in the markup for the control, and is properly populating.  However, the 'Add' button is disabled, and this is undesired.  The edit and delete buttons remain enabled.

    Thinking that it could have something to do with the custom template, I have turned it off, and enabled autoGenerateFields.  This does not help.

  2. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 09 May 2011 Link to this post

    Hello Matt Leeds,

    Usually the add button is disabled , when the source collection does not allow adding items.
    Please share some info - what type of collection do you use as ItemsSource for RadDataForm. I am sure we can think of some solution here .

    Regards,
    Pavel Pavlov
    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
  3. DevCraft banner
  4. Matt Leeds
    Matt Leeds avatar
    12 posts
    Member since:
    Apr 2010

    Posted 09 May 2011 Link to this post

    It uses an object of type "ObservableCollection".  That is:

    ObservableCollection<MyApplication.CoreService.AssetCommentsContainer>

    Where "AssetCommentsContainer" is a custom object.
  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 09 May 2011 Link to this post

    Hello,

     Do you have parameterless constructor for this type (AssetCommentsContainer)?

    Best wishes,
    Vlad
    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
  6. Matt Leeds
    Matt Leeds avatar
    12 posts
    Member since:
    Apr 2010

    Posted 09 May 2011 Link to this post

    No, it has one constructor, which takes the type "System.Data.DataRow".
  7. Answer
    Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 09 May 2011 Link to this post

    Hi,

     In this case automatic add will not work. You need to provide parameterless constructor.

    Greetings,
    Vlad
    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
  8. Matt Leeds
    Matt Leeds avatar
    12 posts
    Member since:
    Apr 2010

    Posted 09 May 2011 Link to this post

    I have now added a parameterless constructor, but this did not enable the add button.  I also tried getting rid of the parameterized constructor, so that there was only the parameterless one, also with no luck.
  9. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 09 May 2011 Link to this post

    Hi Matt ,

    It seems there is some confusion here. I have noticed that this post is under the Silverlight section  (RadDataForm for Silverlight) . Yet you mention System.Data.DataRow which I believe is not present in Silverlight.

    To avoid further confusion , I may suggest you the following - can you send me your project ( or a smaller version of it which exposes the issue ) . An alternative  would be to specify which platform ( WPF or Silverlight) are you using and paste me the implementation of your objects and the the way they are fed to RadDataForm(c# /XAML)   so I can reproduce the problem here.

    Regards,
    Pavel Pavlov
    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
  10. Matt Leeds
    Matt Leeds avatar
    12 posts
    Member since:
    Apr 2010

    Posted 09 May 2011 Link to this post

    We have a library which instantiates the custom objects which are fed to the the Silverlight part of the application.  These libraries do have access to the System.Data namespace.

    We do have a different page where the the RadDataForm Add button is working.  It has a very similar custom object fed to the control in a very similar way which does have the parameterized constructor accepting the DataRow and does not have a parameterless constructor at all.  I am having difficulty determining what critical thing is different between these two Silverlight RadDataForms and / or the objects that are supporting them.  If you can tell me the precise requirements for objects that are intended to support the full functionality of the RadDataForm, I can make certain that our objects comply.  If there are other factors which influence when the add button is enabled, this would be useful to know as well.  In addition, is there a way to simply turn the add button on programmatically?

    Perhaps there is some more technical documentation than that which I have found so far?

    I do not know for certain, but I don't think I can send our project to you.
  11. Matt Leeds
    Matt Leeds avatar
    12 posts
    Member since:
    Apr 2010

    Posted 09 May 2011 Link to this post

    I apologize:  The parameterless constructor is working after all.  Too much to explain why I missed applying this in the correct spot, but it does work.  I will mark that answer as the correct one.

    Thank you.
Back to Top
DevCraft banner