forum

Home / DeveloperSection / Forums / GridView to add HyperLink column dynamically

GridView to add HyperLink column dynamically

Anonymous User303931-Aug-2014

We read from XML and create columns in asp gridview. Also same XML is used to create columns in a data table.

We populate that data table with desired data and bind data table to gridview using server side code.

I want to display hyperlink in gridview and not sure how to manage it. Since we are not using RowDataBound method.

Code 

foreach (XmlNode columnNode in columnNodes)

{

dc = new DataColumn(columnNode.Attributes["ColumnName"].Value,Type.GetType("System.String"));

dt.Columns.Add(dc);

boundField = new BoundField();

boundField.HeaderText = columnNode.Attributes["ColumnDisplayName"].Value;

boundField.DataField = columnNode.Attributes["ColumnName"].Value;

boundField.SortExpression = columnNode.Attributes["ColumnName"].Value;

grdView.Columns.Add(boundField);

}

where dc is datacolumn, dt is data table and grdView is grid view.


Updated on 01-Sep-2014
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By