custom column format for asp.net datagrid

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
 
E

Eliyahu Goldin

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.
 

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

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top