Change Dynamic TableCell TextBox

scross1276
scross1276 used Ask the Experts™
on
I'm dynamically generating a table using C# & ASP.NET.  I need to know how to alter the attributes of textboxes and dropdownlists that are dynamically created in the table.
TableCell tCell2 = new TableCell();
tCell2.Controls.Add(new TextBox());
tRow.Cells.Add(tCell2);

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
I figured it out.  Here's the answer...
                        TextBox txtDescription = new TextBox();
                        txtDescription.Style["width"] = "250px";
 
                        TableCell tCell2 = new TableCell();
                        tCell2.Controls.Add(txtDescription);
                        tRow.Cells.Add(tCell2);

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial