I have a table in the .aspx
file structured like this
<asp:Table ID="tblRoles" runat="server" GridLines="Both" HorizontalAlign="center" Style="margin-top: 1em; margin-left:1em; margin-right:1em;">
<asp:TableHeaderRow ForeColor="White" BackColor="DodgerBlue" Style="background: linear-gradient(to bottom right, #6688FF, #AACCFF); height: 4em; text-align: center; text-transform: capitalize;">
<asp:TableHeaderCell Text="one"/>
<asp:TableHeaderCell Text="two" width="10%"/>
<asp:TableHeaderCell Text="three" width="10%"/>
</asp:TableHeaderRow>
</asp:Table>
The cs
file contains the code that fills the table with content and buttons as shown below:
TableRow row = new TableRow();
TableCell cellEdit = new TableCell();
Button btnEdit = new Button();
btnEdit.Text = "Edit";
btnEdit.Attributes.Add("onclick", "return btnEditClick();");
cellEdit.Controls.Add(btnEdit);
While the overall structure of the table looks great on the page, the content inside each cell is currently aligned to the left. I am wondering if there is a way to align the content centrally within the table?