Adding a HyperLinkField to a DatGrid

J

John Smith

I am trying to add a HyperLinkField to a datagrid programatically, but
I keep running into the error:

"CS1502: The best overloaded method match for
'System.Web.UI.WebControls.DataGridColumnCollection.Add(System.Web.UI.WebControls.DataGridColumn)'
has some invalid arguments"

Here is my code

HyperLinkField column = new HyperLinkField();
column.DataNavigateUrlFields = strArray;
column.DataNavigateUrlFormatString = "edit.aspx?LogID={0}";
column.DataTextField = strArray[1];
column.DataTextFormatString = "{0}";
gridYear.Columns.Add(column);
gridYear.DataBind();


Can someone tell me what I am doing wrong?



Thank you!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top