Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert TableCell text into hyperlink

Tags:

c#

asp.net

I am fetching data from a sql query into an asp table in cs code behind page

TableCell tCell1 = new TableCell();
tCell1.Text = myDataRow["tid"].ToString();

I want to convert that id into a hyperlink. How can I do that?

like image 614
Bhrugesh Patel Avatar asked Jan 18 '23 06:01

Bhrugesh Patel


1 Answers

You can create a HyperLink control and add it as a child of the TableCell:

HyperLink link = new HyperLink();
link.NavigateUrl = ...
link.Text = ...

TableCell tCell1 = new TableCell();
tCell1.Controls.Add(link);
like image 165
Jordão Avatar answered Jan 24 '23 17:01

Jordão