Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
245
WebDropDown Width Resetting
posted

I have the following webDropDown inside an update panel:

//Sets the selected value as the text, rather than the selected text
function webDropDown_SelectionChanging(sender, e) {
    e.get_value()[0].set_text(e.get_value()[0].get_value());
}    

On page load:

With departments
.SQL = "SELECT DI.DEPARTMENT DEPT, DI.DEPARTMENT_DESC DESCR FROM COMMISH.DEPARTMENT_INFO DI WHERE DI.ACTIVE_FLAG = 'Y' ORDER BY DEPARTMENT_NUMBER"
If .Select_Records_Custom_SQL(dtData) Then
Me.wddDepartment.DataSource = dtData
Me.wddDepartment.ValueField = "DEPT"
Me.wddDepartment.TextField = "DESCR"
Me.wddDepartment.DataBind()
Me.wddDepartment.NullText = " "
'uwcDepartment.DataSource = dtData
'uwcDepartment.DataBind()
End If
End With

When user clicks search:

wddDepartment.CurrentValue = CStr(.Order_Department)

Everything works like I want it to, with one exception.  When the user clicks search and the dropdown list value is updated, the dropdown width ignores its 50px width setting and is set to some default value.  First question obviously is why does it do this?  And second, how do I get it to remain at the 50px setting? 

Edit: If I remove the page_load function where I populate the dropdown list, the width does not change.  

Parents
  • 10685
    Offline posted

    Hello,

    There are actually two different setting for the WebDropDown Width. The first one is managing the WDD's input width itself and the second one is managing the width of the container for the WDD Items.
    Width="50px"
    DropDownContainerWidth="400px"  
    Both could differ and yet I suggest keeping these the same for better user experience. By default, if you would like to set the containerWidth to be wide enough to match the width of the longest items inside, you could use empty string for it like:
    DropDownContainerWidth=""
    I am attaching a runnable code sample illustrating this. Both widths are set via the Markup.  

    Please let me know if you require further assistance. In such case, please feel free to modify my sample with your approach, so I could take a look at the actual code in use.

    WDDwidth_UpdatePanel.zip
Reply Children