0

I'm developing a WebPart for Sharepoint 2010. I created custom properties but i would like to change the layout. I would like that the elements below would look like the default elements(spacing and padding etc).

protected override void CreateChildControls()
    {
        PartPanel = new UpdatePanel();
        PartPanel.UpdateMode = UpdatePanelUpdateMode.Conditional;

        label2 = new Label();
        label2.Text = "Choose component <br/><br/>";
        ddl = new DropDownList();
        ddl.ID = "ddl";
        ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged);
        ddl.EnableViewState = false;
        ddl.AutoPostBack = true;
        ddl.Items.Insert(0 ,"--Select--");
        ddl.Items.Insert(1, "a");
        ddl.Items.Insert(2, "b");

        label1 = new Label();
        label1.Text = "";

        channels = new DropDownList();
        channels.ID = "a";
        channels.Visible = false;
        channels.DataSource = Enumerable.Range(1, 15);
        channels.DataBind();

        videos = new TextBox();
        videos.Visible = false;

        PartPanel.ContentTemplateContainer.Controls.Add(label2);
        PartPanel.ContentTemplateContainer.Controls.Add(ddl);
        PartPanel.ContentTemplateContainer.Controls.Add(label1);
        PartPanel.ContentTemplateContainer.Controls.Add(videos);
        PartPanel.ContentTemplateContainer.Controls.Add(channels);

        this.Controls.Add(PartPanel);
        base.CreateChildControls();

    }

what to do here? As you noticed i added a few break lines but that doesn't do what i want.

1 Answer 1

0

check what CSS classes the standard properties has and add those to your controls CssClass property.

Regards, Martin

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.