Wednesday, August 20, 2008

Adding HyperLink Field programmatically Dymaic to a GridView

GridView gv = new GridView();
gv.DataSource = dt;
gv.AutoGenerateColumns = true;
HyperLinkField HLF = new HyperLinkField();

HLF.Text = "Test";
HLF.HeaderText = "Test";
HLF.Visible = true;
gv.Columns.Add(HLF);
gv.DataBind();
PlaceHolder1.Controls.Add(gv);

1 comment:

Ali.M.Habib said...

I want to bind the gridview with data from table and need one of the retrived columns be a hyperlink
not add new one
How can I solve that Dynamicaly