If a Web server control property's data type is a primitive type, such as a
To set a property value based on simple values
-
Assign the value as a literal or variable, as in the following example:
Visual BasicВ
Copy CodeLabel1.Text = "Hello" Datagrid1.PageSize = 5
C#В
Copy CodeLabel1.Text = "Hello"; DataGrid1.PageSize = 5;
To set a property value based on an enumeration
-
Assign the value using one of the enumeration values. ASP.NET can resolve the enumeration based on the property's type. The following code example illustrates setting a property using an enumeration:
Visual BasicВ
Copy Code'Uses TextBoxMode enumeration TextBox1.TextMode = TextBoxMode.SingleLine 'Uses ImageAlign enumeration Image1.ImageAlign = ImageAlign.Middle
C#В
Copy Code// Uses TextBoxMode enumeration TextBox1.TextMode = TextBoxMode.SingleLine; // Uses ImageAlign enumeration Image1.ImageAlign = ImageAlign.Middle;
jscript editor
Web designer