| |||||||||||||
WebControl.Width PropertySystem.Web.UI.WebControls Namespace WebControl Class Sets or retrieves the width of a Web control. Syntax
Property ValueA Unit object that represents the width of the control.
This property is read/write with no default value. Exceptions
RemarksThis property specifies the calculated width of the object, in pixels. For table rows and cells, this property has a range of 0 to 32750 pixels. Percentage values are based on the width of the parent object. If the value of the corresponding HTML attribute was set using a percentage, this property specifies the width in pixels represented by that percentage. The scripting property is read/write for the Image class, but read-only for other controls.
This property will render on downlevel browsers for some controls only. It will not render downlevel for Label, HyperLink, LinkButton, any validator controls, or for CheckBoxList, RadioButtonList and DataList when their RepeatLayout property is Flow. ExampleThe following example shows how to declaratively set the Width property of a Web control at design time. <asp:panel id = "myPanel" runat = "server" width=300 /> The example below shows how to programmatically set the Width property at run time, depending on user input. void Page_Load ( Object src, EventArgs e ) {
if ( !IsPostBack ) {
for ( int i=100; i<=500; i+=50 ) {
widthSelect.Items.Add ( i.ToString ( ) );
}
widthSelect.SelectedIndex = 2;
}
myTable.Width = int.Parse ( widthSelect.SelectedItem.Text );
}
See AlsoWebControl Members WebControl.Height Style Base Web Control Properties |
| ||||||||||||
Check out related books at Amazon
© 2000-2008 Rey Nuñez All rights reserved.
If you have any question, comment or suggestion
about this site, please send us a note
You can help support aspxtreme