More in this section

Forums / Developing with Sitefinity / Customization of New Letter Subscrition Form Control

Customization of New Letter Subscrition Form Control

2 posts, 0 answered
  1. kiran
    kiran avatar
    13 posts
    04 Jun 2009
    04 Jun 2009
    Link to this post
         I want to subscribe the user to a group for sending news letters while registration.sitefinity provides news letter subscription control but my registration functionality is in different user control,here we provide an check box for the user.If he select that checkbox and click on registration submit button the user have to add to subscription group automatically for sending news letters.

    How can i customize the news letter user control,any suggestions.
    please help!
  2. Parvan
    Parvan avatar
    151 posts
    24 Sep 2012
    04 Jun 2009
    Link to this post
    Hi kiran,

    It will not be easy to integrate the SubscriptionForm control in your registration.
    It is better to use the DataManager class to subscribe the user to specific group directly in your code.
    This can be accomplished by the following sample code:
    if (checkBox.Checked// the checkbox for subscription 
        string subscriberEmail = "";//yourTextBox.Text; 
        DataManager newsletterManager = new DataManager(); 
        ISubscriber subscriber = newsletterManager.GetSubscriber(subscriberEmail); 
        if (subscriber == null
            subscriber = newsletterManager.CreateSubscriber(subscriberEmail); 
            subscriber.FirstName = "FirstNameOfUser";//first name of the user 
            subscriber.LastName = "LastNameOfUser";//last name of the user 
            IGroupSubscriber gSub = null
            // For each subscriber group 
            IList list = newsletterManager.GetGroups(""); 
            foreach (IGroup group in list) 
                // this is the group name 
                if (group.GroupName == "Group name user should be subscribed"
                    gSub = newsletterManager.CreateGroupSubscriberRelation( 
                       group.GroupId, subscriber.SubscriberId); 
    The places where you should enter user information and group name are highlighted with green.

    I hope this helps you.

    Best wishes,
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
2 posts, 0 answered