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

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)
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Ramkisan JagtapConnect With a Mentor Lead DeveloperCommented:
.txtbx {
    width: 100%;
}
0
 
Ramkisan JagtapLead DeveloperCommented:
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

0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Hi. Thanks. Please could you help me with the CSS code.
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Great. Thanks very much
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.