Where's the text in a hyperlink col?

T

Tina

I'm going through a DataGridItem looking to find the text in a hyperlink
column. It's not in mydataGridItem.cells(3).text. Where is it?
thanks,
T
 
K

Ken Cox [Microsoft MVP]

Hi Tiny,

Try setting trace="true" in your page so you can see all of the objects that
appear. You might find that there are literal controls in the item that you
haven't accounted for.

Ken

MVP [ASP.NET]
 
T

Tina

The trace is a mess that shows up behind my controls and report - unreadable
as is often the case. You would think there would be some docs on such a
thing.
T

Ken Cox said:
Hi Tiny,

Try setting trace="true" in your page so you can see all of the objects
that appear. You might find that there are literal controls in the item
that you haven't accounted for.

Ken

MVP [ASP.NET]


Tina said:
I'm going through a DataGridItem looking to find the text in a hyperlink
column. It's not in mydataGridItem.cells(3).text. Where is it?
thanks,
T
 
S

Saravana

Hi,

It wont be accessible through mydataGridItem.cells(3).text. You need to
access your control inside controls collection in a cell, for example.

mydataGridItem.cells(3).Findcontrol("yourcontrolname") or
mydataGridItem.cells(3).control(0)
 
T

Tina

The Immediate window readout is....
?item.Cells(3).Controls(0)
{System.Web.UI.WebControls.HyperLink}
[System.Web.UI.WebControls.HyperLink]:
{System.Web.UI.WebControls.HyperLink}
BindingContainer: {System.Web.UI.WebControls.DataGridItem}
ClientID: "dgbudgets__ctl2__ctl0"
Controls: {System.Web.UI.ControlCollection}
EnableViewState: True
ID: Nothing
NamingContainer: {System.Web.UI.WebControls.DataGridItem}
Page: {ASP.TestFeeder_aspx}
Parent: {System.Web.UI.WebControls.TableCell}
Site: Nothing
TemplateSourceDirectory: "/GridPrinter"
UniqueID: "dgbudgets:_ctl2:_ctl0"
Visible: True

but there is no text value or ID that could get a text value. I use
findcontrol a lot for template columns but using the column name with
findcontrol finds nothing. I know the text has to be in there somewhere.
T
 
G

GaryB

I've been lurking this conversation because I have the same need. Neither
of those two methods work. The first doesn't work because a hyperlink is
not a template column. The second, ...control(0) show a hyperlink object
but no text or anything that contains the text. I'll try a new thread on
this. seems nobody knows.
G
 
S

Saravana

If you post your code, i will tell you the exact way to find the text of
that hyperlink. Surely you can find it using the method i mentioned in
previous post.

--
Saravana
http://dotnetjunkies.com/WebLog/saravana/
www.ExtremeExperts.com


Tina said:
The Immediate window readout is....
?item.Cells(3).Controls(0)
{System.Web.UI.WebControls.HyperLink}
[System.Web.UI.WebControls.HyperLink]:
{System.Web.UI.WebControls.HyperLink}
BindingContainer: {System.Web.UI.WebControls.DataGridItem}
ClientID: "dgbudgets__ctl2__ctl0"
Controls: {System.Web.UI.ControlCollection}
EnableViewState: True
ID: Nothing
NamingContainer: {System.Web.UI.WebControls.DataGridItem}
Page: {ASP.TestFeeder_aspx}
Parent: {System.Web.UI.WebControls.TableCell}
Site: Nothing
TemplateSourceDirectory: "/GridPrinter"
UniqueID: "dgbudgets:_ctl2:_ctl0"
Visible: True

but there is no text value or ID that could get a text value. I use
findcontrol a lot for template columns but using the column name with
findcontrol finds nothing. I know the text has to be in there somewhere.
T

Saravana said:
Hi,

It wont be accessible through mydataGridItem.cells(3).text. You need to
access your control inside controls collection in a cell, for example.

mydataGridItem.cells(3).Findcontrol("yourcontrolname") or
mydataGridItem.cells(3).control(0)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,607
Members
45,240
Latest member
pashute

Latest Threads

Top