Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > General Discussions > Increase the width of DropDownList

Answered Increase the width of DropDownList

Feed from this thread
  • Sabuj avatar

    Posted on Jan 30, 2012 (permalink)

    I think this a simple problem but cant figure out. In my project I need to increase the width of the dropdownlist. How do i do it?
    Here is my Dropdownlist
    @Html.Telerik.DropDownListFor(Function(model) model.OrderEntityID).BindTo(New SelectList(ViewBag.OrderEntities, "OrderEntityID", "Name")).ClientEvents(Sub(events) events.OnChange("orderEntityID_OnChange"))

    Have tried .DropDownHtmlAttributes( new { style = "width = 150px; font-size: 10px; height: 70px;" } )...
      

    Reply

  • Answer Georgi Tunev Georgi Tunev admin's avatar

    Posted on Jan 31, 2012 (permalink)

    Hello Sabuj,

    With DropDownHtmlAttributes you are controlling the items' list only, not the whole dropdown. In addition, there is no width= 150px syntax in CSS, it should be widht:150px
    Try
    @(Html.Telerik().DropDownList()
        .Name("someList")
        .Items(item =>
                {
                    item.Add().Text("Item1").Value("1").Selected(true);
                    item.Add().Text("Item2").Value("2");
                    item.Add().Text("Item3").Value("3");
                })
                //set the width of the items list only 
                .DropDownHtmlAttributes(new { style = string.Format("width:{0}px", 200) })
                //set the width of the whole dropdown (incl. the main input)
                .HtmlAttributes(new { style = string.Format("width:{0}px", 400) })
    )


    All the best,
    Georgi Tunev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now

    Reply

  • Sabuj avatar

    Posted on Feb 1, 2012 (permalink)

    Hello Georgi,
    Thank you much for your reply.
    That helped.

      

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > General Discussions > Increase the width of DropDownList