I have the following code:
private void AdjustWithOfDropDownList(DropDownList ddlCombo)
{
// Get current width
int width = Convert.ToUInt16(ddlCombo.Width.Value);
int newWidth = 0;
for (int ilcv = 0; ilcv < ddlCombo.Items.Count; ilcv++)
{
newWidth = ddlCombo.Items[ilcv].ToString().Length;
if (width < newWidth)
{
width = newWidth;
}
}
ddlCombo.Width = width;
}
The width has say 137 initially and when I check the value of 'ddlCombo.Width = width' it shows 23 for the longest row in the ddl. Some of the items are getting chopped off. How can I put the 'correct' value?
...
Go to the complete details ...