• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 342
  • Last Modified:

Simple C# Question about moving something to a new line

Hey I am not very familiar with c# at all, but I have a form that I am using as a contact form in Sharepoint as a webpart. All I am wanting to do is separate the text box labels and text boxes on to different lines. Attached is the code that handles the main label at the top (which is fine) and the first row which I want to put on two lines. I know this has to be very simple. Let me know if there is anymore information you need and I will respond quickly.

Thanks in advance!


base.CreateChildControls();

            Table t;
            TableRow tr;
            TableCell tc;

            // A table that is used to layout the controls
            t = new Table();

            // Label with instructions for the user
            tr = new TableRow();
            tc = new TableCell();
            tc.ColumnSpan = 2;
            tc.VerticalAlign = VerticalAlign.Top;
            Label lblInstructions = new Label();

            lblInstructions.Text = "<br>Did a team member of the hospital go above and beyond for you or someone else?<br/>" +
                                   "Did they help a guest or a peer have a pleasant and enjoyable experience at xxxxx " +
                                   "<br>xxxxx xxxxx xxxxx xxxx? If so, and you would like to show your appreciation <br/>" +
                                   "towards this person, please tell us what they did for you or someone else. " +
                                   "<br>Fill out this form and tell us their name and information about what you experienced. <br/>" +
                                   "That way, we can recognize this person's good efforts throughout the hospital." +
                                   "<br> <br/>";
            tc.Controls.Add(lblInstructions);
            tr.Controls.Add(tc);

            t.Controls.Add(tr);

            // Contact Name label
            tr = new TableRow();
            tc = new TableCell();
            tc.Style["padding-top"] = "7px";
            tc.VerticalAlign = VerticalAlign.Top;
            Label lblContactName = new Label();
            lblContactName.Text = "Name of the team member:";
            tc.Controls.Add(lblContactName);
            tr.Controls.Add(tc);
            
            
            

            // Contact Name textbox
            tc = new TableCell();
            tc.VerticalAlign = VerticalAlign.Top;
            txtContactName = new TextBox();
            txtContactName.ID = "txtContactName";
            txtContactName.Width = Unit.Pixel(300);
            tc.Controls.Add(txtContactName);
            tr.Controls.Add(tc);
            t.Controls.Add(tr);

Open in new window

screencapture.PNG
0
armfull
Asked:
armfull
1 Solution
 
armfullAuthor Commented:
Never mind I figured it out. I had forgot to add the t.Controls.Add(tr); when I edited then label
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now