Prop Webcontrol Tablerow Horizontalalign
## ASP.NET TableRow HorizontalAlign Property
The `HorizontalAlign` property is a member of the `TableRow` class in ASP.NET Web Forms. It is used to get or set the horizontal alignment of the content within a table row (``).
---
## Definition and Usage
The `HorizontalAlign` property specifies how the text and controls inside the cells of a specific table row are aligned horizontally. When you set this property on a `TableRow`, the alignment style is inherited by all the `TableCell` controls within that row, unless overridden by individual cell settings.
---
## Syntax
```xml
```
### Property Values
| Value | Description |
| :--- | :--- |
| `Center` | Centers the content within the row's cells. |
| `Justify` | Stretches the content to align with both the left and right margins of the cells. |
| `Left` | Aligns the content to the left side of the cells. |
| `NotSet` | *(Default)* The horizontal alignment is not set. The alignment behavior defaults to the browser's default or inherits from parent containers. |
| `Right` | Aligns the content to the right side of the cells. |
---
## Code Example
The following example demonstrates how to set the `HorizontalAlign` property of an `asp:TableRow` control to align its cell contents to the right.
```xml
<%@ Page Language="C#" %>
TableRow HorizontalAlign Example
```
---
## Considerations and Best Practices
1. **Inheritance and Overriding**: Setting `HorizontalAlign` on an `asp:TableRow` acts as a default for all cells (`asp:TableCell`) within that row. If you want a specific cell to have a different alignment, you can override it by setting the `HorizontalAlign` property directly on that individual `asp:TableCell`.
2. **CSS Alternative**: While using the server-side `HorizontalAlign` property is convenient, in modern web development, it is often recommended to manage layout and alignment using CSS classes (e.g., via the `CssClass` property) to maintain a clean separation of concerns between markup and styling.
YouTip