Base Property Samples
These samples demonstrate base class properties inherited by all Web Forms components:
AccessKey, ToolTip, and style properties like
BackColor, ForeColor, Width, and Height.
1. AccessKey Property
The AccessKey property sets a keyboard shortcut (Alt+key on Windows, Ctrl+Alt+key on Mac)
that moves focus to the control. It renders as the HTML accesskey attribute.
Button (AccessKey="B"):
TextBox (AccessKey="T"):
HyperLink (AccessKey="H"): Sample Link
CheckBox (AccessKey="C"):
Panel (AccessKey="P"):
Image (AccessKey="I"):

<Button Text="Click Me" AccessKey="B" />
<TextBox AccessKey="T" Text="Press Alt+T to focus" />
<HyperLink Text="Sample Link" NavigateUrl="https://example.com" AccessKey="H" />
<CheckBox Text="Toggle me" AccessKey="C" />
<Panel AccessKey="P">Panel content</Panel>
<Image AccessKey="I" ImageUrl="/images/blazor-logo.png" AlternateText="Blazor Logo" />
2. ToolTip Property
The ToolTip property renders as the HTML title attribute.
Hover over each control to see the tooltip text.
Button:
TextBox:
Label: Informational label
HyperLink: Hover for info
CheckBox:
Panel:
<Button Text="Hover Me" ToolTip="This is a Button tooltip" />
<TextBox ToolTip="Enter your name here" Text="Hover over me" />
<Label Text="Informational label" ToolTip="This label provides context" />
<HyperLink Text="Hover for info" NavigateUrl="#" ToolTip="Navigate to example.com" />
<CheckBox Text="Agree to terms" ToolTip="Check to accept the terms of service" />
<Panel ToolTip="This panel groups related content">Content</Panel>
3. GridView Style Properties
The BackColor, ForeColor, Width, and Height
properties render as inline CSS on the GridView's <table> element.
Styled GridView
| ID | Name | Department |
|---|---|---|
| 1 | Alice Johnson | Engineering |
| 2 | Bob Smith | Marketing |
| 3 | Carol White | Engineering |
| 4 | Dave Brown | Sales |
<GridView ItemType="Employee"
Items="@_employees"
AutoGenerateColumns="false"
BackColor="@("#f0f8ff")"
ForeColor="@("#333366")"
Width="Unit.Pixel(600)"
Height="Unit.Pixel(200)"
GridLines="GridLines.Both"
Caption="Styled Employee Table"
ToolTip="Employee data with custom styling">
<Columns>
<BoundField DataField="Id" HeaderText="ID" />
<BoundField DataField="Name" HeaderText="Name" />
<BoundField DataField="Department" HeaderText="Department" />
</Columns>
</GridView>
4. Combined Usage
Properties can be combined on a single control for full customization.
<Button Text="Fully Configured"
AccessKey="F"
ToolTip="Alt+F to focus, styled with colors"
BackColor="WebColor.Navy"
ForeColor="WebColor.White"
CssClass="btn" />