I was trying to create a table and add rows and cells in it using c#.

And tried to hyperlink in a tablecell, tried to add styles in the hyperlink without touching the css class and open the hyperlink popup via navigateurl in a new window.

putting hyperlink on tablecell:

TableRow tr = new TableRow();
TableCell td = new TableCell();
HyperLink hyper1 = new HyperLink();
hyper1.NavigateUrl = “https://techolyvia.wordpress.com/category/technical/sharepoint/spgroup/”;
hyper1.Text = “SPGroup”;
td.Controls.Add(hyper1);
tr.Cells.Add(td);
tableOuterCtrl.Rows.Add(tr);

Using navigateurl to open in a new window:

hyper1.Target = “_blank”;

Add styles in hyperlink without modifying css classes.

hyper1.Style.Add(“font”, “normal 8pt Verdana;”);
hyper1.Style.Add(“color”, “black”);

full code goes like this:
tableOuterCtrl = new Table();
tableOuterCtrl.CellPadding = 0;
tableOuterCtrl.CellSpacing = 0;
Controls.Add(tableOuterCtrl);
TableRow tr;
TableCell td;
tr = new TableRow();
tr.Width = Unit.Percentage(100);
tableOuterCtrl.Rows.Add(tr);
td = new TableCell();
HyperLink hyper1 = new HyperLink();
td.Wrap = false;
td.Width = Unit.Percentage(100);
hyper1.Style.Add(“font”, “normal 8pt Verdana;”);
hyper1.Style.Add(“color”, “black”);
hyper1.NavigateUrl = “https://techolyvia.wordpress.com/2009/03/31/report-to-show-all-users-and-user-groups-in-sharepoint-site/”;
hyper1.Target = “_blank”;
hyper1.Text = “Displaying all users and groups through coding”;
td.Controls.Add(hyper1);
tr.Cells.Add(td);
tableOuterCtrl.Rows.Add(tr);
this.Controls.Add(tableOuterCtrl);