Link to home
Start Free TrialLog in
Avatar of poultarp
poultarp

asked on

ASP.NET C#: Dynamic text in GridView HyperLinkField

Hello All

I have a GridView on an ASP.NET C# website that contains data from a database. In the GridView I have a HyperLinkField.

What I want to do is change the text of the HyperLinkField depending on the value of one of the GridView Columns (if the column is 0 the HyperLinkField text should be "Activate" and if the value is 1 the text should be "Block").

Does anyone know how this can be done?

Regards
Søren Augustesen
ASKER CERTIFIED SOLUTION
Avatar of markmiddlemist
markmiddlemist
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi

you can use this

Text='<%# Eval("colname")%> == "1" ? "Yes" : "No"

this is just example
Avatar of poultarp
poultarp

ASKER

Hello Mark

Thank you for your answer.

I have one quick question:

In the <%Eval %> line, how do I pass more than one value to the URL parameters?

Regards
Søren Augustesen
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you Mark - it works just as I want it to!

Regards
Søren Augsutesen
Glad to help. It's a very useful technique, and one I use almost daily.