Wrox Programmer Forums
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics 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 July 4th, 2007, 07:00 AM
Registered User
 
Join Date: Jul 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default gridview

I am using gridview in my application. in that i assign the data(dataset) dynamically to gridview. i want how to make the columns values as hyperlink.(i want to make that column as template field) at runtime.

 
Old July 4th, 2007, 08:20 AM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

You could try something like below once your bind your gridview:

  HyperLinkField hf = new HyperLinkField();
            hf.DataTextField = "ProductID";
            hf.NavigateUrl = "http://www.microsoft.com/";
            hf.HeaderText = "Header Text";
            hf.SortExpression = "ProductID";
            grdView.Columns.Add(hf);

Regards
Mike

Don't expect too much, too soon.
 
Old July 4th, 2007, 01:10 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

You'll need to create the template column before you databind if you want to be able to bind data values to the hyperlink control. what about using a hyperlink column?

-Peter





Similar Threads
Thread Thread Starter Forum Replies Last Post
Get GridView Cell Value Based on GridView Column stublair C# 2008 aka C# 3.0 0 September 4th, 2008 08:30 AM
Gridview user007 ASP.NET 2.0 Basics 2 June 22nd, 2008 09:30 AM
Gridview Thinlizzy ASP.NET 2.0 Basics 2 July 20th, 2007 08:33 AM
GridView Sheraz Khan ASP.NET 2.0 Basics 1 July 19th, 2007 10:28 AM
GridView heba ASP.NET 2.0 Professional 0 May 28th, 2007 01:59 AM





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