custom column format for asp.net datagrid

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi I have a datagrid bound to a datareader. the datareader returns two columns authorId, and authorName.

How do i combine the data to render one column with the name of the author as a hyperlink.

The column is currently bound to the authorName field and
I have a DataFormatString of

"<a href='javascript:void(0)' onclick='showDirectoryEntry(\"{0}\")'>{0}</a>"

which does the link, but this puts the authorName in both slots. I need to combine the data from the authorId field into the first one.

Adam
 
Adam,

You have to have separate databind expressions for every slot. You can
easily use a template column for this.

Eliyahu

Hi I have a datagrid bound to a datareader. the datareader returns two
columns authorId, and authorName.
How do i combine the data to render one column with the name of the author as a hyperlink.

The column is currently bound to the authorName field and
I have a DataFormatString of

"<a href='javascript:void(0)'
onclick='showDirectoryEntry(\"{0}\")'>{0} said:
which does the link, but this puts the authorName in both slots. I need to
combine the data from the authorId field into the first one.
 
Back
Top