Custom Registration Form

Jun 26, 2012 at 9:57 AM

HI,

I've working from a custom design for a registration form, and modifying the CreateUserStep template accordingly. This is great and it all works except for the default control thats adds a table around the whole thing.

Does anyone know of a rendering method that removes this table, I've tried one (this is in the MembershipRequestControl.cs):

protected override void Render(HtmlTextWriter writer)
        {
            if (CreateUserStep.ContentTemplate != null && this.ActiveStep == this.CreateUserStep)
            {
                WebControl creatediv = new WebControl(HtmlTextWriterTag.Div);
                creatediv.CssClass = this.CssClass;
                CreateUserStep.ContentTemplate.InstantiateIn(creatediv);
                //Clears table
                CreateUserStep.ContentTemplateContainer.Controls.Clear();
                // Adds the contenttemplate
                CreateUserStep.ContentTemplateContainer.Controls.Add(creatediv);
                creatediv.RenderControl(writer);
                
                if (CreateUserStep.CustomNavigationTemplate != null)
                {
                    WebControl navdiv = new WebControl(HtmlTextWriterTag.Div);
                    navdiv.CssClass = this.CssClass;
                    CreateUserStep.CustomNavigationTemplate.InstantiateIn(navdiv);
                    CreateUserStep.CustomNavigationTemplateContainer.Controls.Clear();
                    CreateUserStep.CustomNavigationTemplateContainer.Controls.Add(navdiv);
                    navdiv.RenderControl(writer);
                }
            }
        }


This works in removing the table but unfortunately, the TemplateHelper in MembershipWebPart.cs then struggles to find the Controls to set them. So although all labels, etc. are rendered, it doesn't setText, etc onto them.

Any ideas?

Thanks in advance,
Bav

Coordinator
Jun 26, 2012 at 2:08 PM

Apart from removing the table from the template itself - so all the controls are free form, or use divs for layout - does it really matter to remove an outer table?  Since it's a web part, SharePoint is going to render a table within a table within a table...20 deep before it actually gets to rendering the template. So does it really matter that it gets rendered within one more table than it already is?

Jul 2, 2012 at 2:04 PM

Ah right, basically the site it's implemented on is heavily customised. It basically now looks like a 'normal' website, and works really well.

The reg form was on a page outside of the site, so basically is the form in the center of the page, and as it's not added as a web part it's not rendering all of the extra sharepoint tables. Anyway, I didn't want to get into adapters as we're pretty short on time so I just added 'width:100%' to the outer table, which allows the registration form to sit in the center! Prob not the best way to do it, but it works!

Sorted!