add a link to a column in dataset

  • Thread starter Thread starter Kevin
  • Start date Start date
K

Kevin

hi all,
I created a dataset and binded it to datagrid, it displays okay. But
now I need to add a link to a column name has_picture, if has_picture=1 then
link shows
else if has_picture=0 then link doesn't show. Basically I don't know how to
implement such a logic. I am assuming I need to do this in codebehind but
how?
 
Handle the ItemDataBound event. This gets fired for every row after data
binding happens. You can then access e.Item.DataItem and get your has_picture
column value. Once you have done that and decide you want to modify that
row, then you can access e.Item.Cells to get the cell with your hyperlink,
use FindControl to get the reference then you can tweak any properties on
it you want.

-Brock
DevelopMentor
http://staff.develop.com/ballen
 

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

Back
Top