ASP.net VB.net Set width of progrematically added DropDownList to 100%

Murray Brown
Murray Brown used Ask the Experts™
on
Hi. The third line in my VB.net code in ASP.net does not set the width of the DropDownList to 100%

                     Dim ddl As New DropDownList
                        ddl.ID = oControlName
                        ddl.Attributes.Add("width", "100%")
                        Me.Panel_Controls.Controls.Add(ddl)
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Ramkisan JagtapLead Developer

Commented:
create a css class for dropdownlist. Set width to 100% in that call and set css class in your code


   
                       Dim ddl As New DropDownList
                       ddl.ID = oControlName
                       ddl.CssClass="YourCssClass"
                       Me.Panel_Controls.Controls.Add(ddl)

Open in new window

Murray BrownASP.net/VSTO Developer

Author

Commented:
Hi. Thanks. Please could you help me with the CSS code.
Lead Developer
Commented:
.txtbx {
    width: 100%;
}
Murray BrownASP.net/VSTO Developer

Author

Commented:
Great. Thanks very much

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