Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 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 Professional 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 3rd, 2007, 09:37 AM
Authorized User
 
Join Date: Jul 2007
Location: Staten Island, NY, USA.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with Programmatically created HyperLinks

I have a problem with Programmatically created HyperLinks - there is
code:

System.Web.UI.WebControls.GridView gvProgrm = new GridView();

foreach (DataColumn col in dt.Columns)
         {
             //Declare BoundField
             if( col.ColumnName == "UserID")
             {
              HyperLinkField hf = new
 HyperLinkField();

                 hf.DataTextField = col.ColumnName;
                 hf.NavigateUrl = "http://www.google.com/";
                 hf.HeaderText = col.ColumnName;
                 hf.SortExpression = col.ColumnName;

                 gvProgrm.Columns.Add(hf);
             }
             else
             {
                 BoundField bFld = null;
                 bFld = new BoundField();
                 bFld.DataField = col.ColumnName;
                 bFld.HeaderText = col.ColumnName;
                 bFld.SortExpression = col.ColumnName;
                 bFld.HtmlEncode = false;
                 gvProgrm.Columns.Add(bFld);
             }
          }

It's working fine except one thing - HyperLinkField does not appears as a link but just as a regular field.



Please advise,

Thanks

Vadim


 
Old July 4th, 2007, 02:21 AM
Friend of Wrox
Points: 1,935, Level: 17
Points: 1,935, Level: 17 Points: 1,935, Level: 17 Points: 1,935, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2004
Location: United Kingdom
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

Well, I have tested your code at my end, and it works fine, I think you must be missing somewhere else, please post the entire HTML and CS code that you have written to bind the gridview, so that we can check and assist you.

Regards
Mike

Don't expect too much, too soon.
 
Old July 5th, 2007, 07:28 AM
Authorized User
 
Join Date: Jul 2007
Location: Staten Island, NY, USA.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Mike,
  you were right it works - just wrong parameter.

Thanks





Similar Threads
Thread Thread Starter Forum Replies Last Post
weird problem with datagrid hyperlinks benya ASP.NET 1.0 and 1.1 Professional 3 March 27th, 2006 11:11 AM
Face problem to use DLL created using VB in VC++ chirag_chauhan Beginning VB 6 1 January 17th, 2005 10:56 PM
hyperlinks problem sbhandar Classic ASP Basics 2 September 2nd, 2004 07:18 PM
problem using asp with database created with vba dave3134 Classic ASP Databases 1 June 8th, 2004 08:16 PM
package created/Installation problem sam1974 Access VBA 1 July 3rd, 2003 07:06 AM





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