1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Trying to duplicate a behavior from polls module

Trying to duplicate a behavior from polls module

5 posts, 0 answered
  1. Nancy
    Nancy avatar
    18 posts
    Registered:
    25 Jan 2008
    25 Jan 2008
    Link to this post

    I have created an Intra Site module for managing contests and contest entry form user control.  On the admin side the user can create a contest (similar to creating a poll). I store the contest name and ID in a database table.  For page creation I have created a user control to drag a contest entry form onto the page (similar to dragging a poll box). Once the user drags a contest entry form onto the page, they need to specify the Contest ID.  I want to mimic the behavior in the poll box control where the user clicks a select button and is shown a list of polls to choose from, only I want to show the list of contests. So far I can get a text box to show up where they can manually type the contest ID using the following code in the properties section of my .cs file.

    [Browsable(true)]
        [Category("Misc")]
        public string ContestIDNum
        {
            get
            {
                return _ContestID;
            }
            set
            {
                _ContestID = value;
            }
        }

    I want to add the select button and present the list of contests. I also want to add text that says 'Click "Edit" to select a contest' when the user drags the contest entry form onto the page. How do I do these things? Thanks for your help.

  2. Vassil Daskalov
    Vassil Daskalov avatar
    261 posts
    Registered:
    18 May 2013
    28 Jan 2008
    Link to this post
    Hello Nancy,

    In order to have a selector for your control, you should add the WebEditor attribute to your property and specify the Type of control to be shown when the Select button is clicked. The Select button is shown automatically for every property which has the WebEditor attribute. Also, the control specified with this attribute should inherit the WebUITypeEditor<T> generic class. Where T is the type of the return value. For more information on how to create custom selectors, you can read in Ivan's blog:

    http://blogs.sitefinity.com/Ivan/Post/07-05-24/working_with_complex_properties_in_custom_public_controls_webtypeeditor_.aspx

    Best wishes,
    Vassil Daskalov
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Nancy
    Nancy avatar
    18 posts
    Registered:
    25 Jan 2008
    28 Jan 2008
    Link to this post
    Thanks!  That worked great!  My control is set except for one little thing. I also want to add text that says 'Click "Edit" to select a contest' when the user drags the contest entry form onto the page.  How do I do this? Thanks again -Nancy
  4. iosmak
    iosmak avatar
    18 posts
    Registered:
    12 Oct 2006
    29 Jan 2008
    Link to this post
    Hi Nancy,

    this blog post explains how to do that :

    Tip : displaying default text for empty controls

    Regards,
    Ivan
  5. iosmak
    iosmak avatar
    18 posts
    Registered:
    12 Oct 2006
    29 Jan 2008
    Link to this post
    Oups... there is something wrong with the link. Here is the url:

    http://blogs.sitefinity.com/Ivan/Post/08-01-04/tip_displaying_default_text_for_empty_controls.aspx
Register for webinar
5 posts, 0 answered