How To Dynamically Set Width to Panel Control?
Posted on 2002-06-17
I have an ASP .Net webform, where I have a Panel control.
I am dynamically creating HyperLink controls, and I am binding them to the Panel control.
My problem is setting the width of the Panel control. If the text of a Hyperlink control is short enough where it leaves room for the next Hyperlink control, the next one fills on the same line.
At the same time, if the text of a HyperLink control goes beyond the width of the Panel control it will split into two lines.
For example, say I have three Hyperlink controls. The first one's text is Setup, and the second's text is Transaction, and the third's text is Post Transaction.
If I make the width of the Panel control wide enough to hold the third Hyperlink's text "Post Transaction", the first line will read "Setup Transaction", instead of "Setup", and the second line being "Transaction".
I cannot find a property in the Panel control that will force objects to list one at a time like a ListView, Listbox, etc.
I've been through capturing the width of the Hyperlink controls and trying to set the width of the Panel control by those values, but nothing works, due to the nature of the length of the text values.
I've set the Wrap property to True, because False keeps all object on the same line.
I've even added VbCrLf at the end of the text value of the Hyperlink controls when creating and binding them, but it doesn't help at all.
Does anyone have any ideas?