Wrox Programmer Forums
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 3rd, 2007, 12:32 AM
Authorized User
Join Date: Jun 2006
Posts: 47
Thanks: 0
Thanked 2 Times in 2 Posts
Default Hyperlink column


Actually i got a datagrid with all hyperlink columns.
Now my requirement is like wenever from database i get '0' i dont need hyperlink below that, i mean to disable it or something like.

Wat to do?
pl help...

Tnx in advance.

Komila Kalia
Software Developer
Reliance engineering Associates (P) Ltd.
Old May 3rd, 2007, 07:42 AM
Authorized User
Join Date: Dec 2004
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to DZukiewicz

Why don't you use a hyperlink control if it is valid, and a literal control if it isn't?

Oh, and DataGrid's are now GridView's in ASP .NET 2.0


Old May 19th, 2007, 01:29 AM
Authorized User
Join Date: Jun 2006
Posts: 47
Thanks: 0
Thanked 2 Times in 2 Posts

hi..thnks fo reply.

but that is only my problem that how to check condition to make it literal control or hyperlink.
if u can suggest me something.

Old May 19th, 2007, 02:40 AM
Imar's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

The easiest way to do it is to bind the Visible property:

<asp:Literal ... Visible='<%= Convert.ToInt32(Eval("YourCol")) == 0 %>' ... />

<asp:HyperLink ... Visible='<%= Convert.ToInt32(Eval("YourCol")) != 0 %>' ... />

This shows the Literal when your database column YourCol is zero, otherwise it shows the HyperLink.



Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hyperlink Column Komila ASP.NET 2.0 Basics 2 April 9th, 2007 10:13 PM
Editing Datagrid with hyperlink column shs BOOK: Beginning ASP.NET 1.0 0 October 24th, 2004 12:13 AM
Hyperlink column in datagrid not working ltdanp21 General .NET 1 July 13th, 2004 03:04 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.