LinkButton in GridView Display Issue

D

Don Miller

I have a GridView that is dynamically-bound to a class object datasource and
in that GridView is a link button column. This linkbutton displays the
number of "matches" found in a database after a query and users can click on
the link (underlined number) to display the matches. This works fine when
there are "matches" but when no matches in the database are found, what
displays in that GridView column is an underlined zero indicating it can be
clicked (and it can be with of course no dataset displayed).

Is there any way when the DataTextField for a link button is zero to NOT
have the linked value underlined or even active as a link? Thanks.
 
D

donet programmer

You might use some GridView event like RowDataBound to disable the
link button
 
D

Don Miller

Thanks. Although not exactly what I wanted, I changed the datasource column
from an integer to a string and pass an empty string to the GridView when
the results were 0 and so nothing shows up in that column. I would have
preferred a zero without an underline and a disabled link.
 

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,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top