How can I make the width of the DropDownExtender (panel)

Started by VelMurugan, Aug 25, 2008, 10:00 AM

Previous topic - Next topic

VelMurugan

How can I make the width of the DropDownExtender (panel) the same as that of the TextBox

The width of the panel that is visible during the drop-down is not the same as that of the targetcontrol of the DropDownExtender. It is displayed to the right by default and adjusts its width according to the contents of the panel as shown below:

However, if you want to manually adjust the width of the drop down and make it the same as that of the textbox, use this code:

<body>
    <form id="form1" runat="server">
     <script type="text/javascript"> 
    function pageLoad()
    {
        $get('panelItems').style.width = $get('TextBox1').clientWidth;
    }
... ScriptManager and other Controls come here
</body>
</html>


Note: Make sure you set the 'ScrollBars' of the panelItems to 'Both' or else the content could flow out of the panel.