Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
|
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 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 September 29th, 2003, 01:11 PM
Authorized User
 
Join Date: Aug 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to rosalynb
Default Accessing the contents of a hyperlink column in a

The problem is the dataGridItem.Cells[0] is returning blanks and it's defined as a hyperlink column which is databound. When the grid loads it looks fine, however, when I attempt to get the data from that cell it returns blanks.


dgLoanStatus is the datagrid

foreach (DataGridItem dataGridItem in dgLoanStatus.Items)
{
 string status = dataGridItem.Cells[0].Text;
 for(int i = 0; i < roleList.Count; i++)
  {
   if(status == roleList[i].ToString())
      dataGridItem.Cells[0].Enabled = true;
   else
      dataGridItem.Cells[0].Enabled = false;
  }
}
__________________
--------------------
Thanks
Rose
[email protected]
 
Old September 30th, 2003, 12:25 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

When you use a HyperLinkColumn in a datagrid, the datagrid create's a HyperLink web control in the grid's cell. So you have to reference the HyperLink control throught the cell's controls collection and convert to a HyperLink:

CType(dataGridItem.Cells(0).Controls(0), HyperLink)

You can then access any of the HyperLink's properties.

CType(dataGridItem.Cells(0).Controls(0), HyperLink).Text
CType(dataGridItem.Cells(0).Controls(0), HyperLink).NavigateUrl

Peter
 
Old October 1st, 2003, 06:33 PM
Authorized User
 
Join Date: Aug 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to rosalynb
Default

Thank you!





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create a Hyperlink based on Cell Contents chatguy Excel VBA 4 October 15th, 2007 09:43 PM
Accessing text in a hyperlink field mvyjim ASP.NET 2.0 Professional 0 March 10th, 2007 05:22 PM
Accessing page contents from browser cache baburman .NET Framework 2.0 3 February 10th, 2005 02:42 AM
Accessing page contents from browser cache baburman General .NET 0 December 6th, 2004 01:44 AM
Accessing the contents of a hyperlink column in a rosalynb ADO.NET 0 September 29th, 2003 01:10 PM





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