DataGrid Hyperlink Re: Post

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Repost since I have had no replies and need some help:

I am trying to access the text of the hyperlink control during the delete
command.

I am retrieving the ID in there as well and it works
fine:e.Item.Cells[0].Text

The hyperlink code is returning "" even though there is a value:
e.Item.Cells[4].Text

I have verified it's the right cell, since I've gone through all of them and
they all return what they're supposed to, except of course the hyperlink!

Is there some other way I can grab that value or am is there some other way
to get the value via the hyperlink control?
 
ann said:
Repost since I have had no replies and need some help:

I am trying to access the text of the hyperlink control during the delete
command.

I am retrieving the ID in there as well and it works
fine:e.Item.Cells[0].Text

The hyperlink code is returning "" even though there is a value:
e.Item.Cells[4].Text

I have verified it's the right cell, since I've gone through all of them and
they all return what they're supposed to, except of course the hyperlink!

Is there some other way I can grab that value or am is there some other way
to get the value via the hyperlink control?


I think this is what you want to do....

The VB code that worked for me was:
CType(e.Item.Cells(4).Controls(0), LinkButton).Text

I don't think I can convert it to C# correctly without trial and error.
The basic idea is to covert the control to a linkbutton and the use
the text property of the link itembutton object.

LinkButton LB = (LinkButton)e.Item.Cells(4).Controls(0);
LB.Text;

Something like that....

Chris
 
Thank you for replying ---

Chris said:
ann said:
Repost since I have had no replies and need some help:

I am trying to access the text of the hyperlink control during the delete
command.

I am retrieving the ID in there as well and it works
fine:e.Item.Cells[0].Text

The hyperlink code is returning "" even though there is a value:
e.Item.Cells[4].Text

I have verified it's the right cell, since I've gone through all of them and
they all return what they're supposed to, except of course the hyperlink!

Is there some other way I can grab that value or am is there some other way
to get the value via the hyperlink control?


I think this is what you want to do....

The VB code that worked for me was:
CType(e.Item.Cells(4).Controls(0), LinkButton).Text

I don't think I can convert it to C# correctly without trial and error.
The basic idea is to covert the control to a linkbutton and the use
the text property of the link itembutton object.

LinkButton LB = (LinkButton)e.Item.Cells(4).Controls(0);
LB.Text;

Something like that....

Chris
 
Back
Top