Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Button control text
Message
 
À
02/03/2004 17:52:17
Information générale
Forum:
ASP.NET
Catégorie:
WebForms
Divers
Thread ID:
00882451
Message ID:
00882544
Vues:
18
I think what you have to do is get a reference to the Control in that column (cell), and cast it. Rather than a button, I have a hyperlink in one of my columns, and I have to do this (C#):
Hyperlink myHyperlink = (Hyperlink) e.Items.Cells[2].Controls[0];

hlink.Text = "My Text"
The "(Hyperlink)" is a cast in C$. In the case of a button, it may be:
Button myButton = (Button) e.Items.Cells[2].Controls[0];

myButton.Text = "My Text"
But I don't know how you cast something in VB.NET.

>I'm using VB but not a problem translating. but I am having one issue
>
>
>Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemDataBound
> If DropDownList1.SelectedItem.Text = "Attatchment's" Then
> If e.Item.ItemType = ListItemType.Item Or _
> e.Item.ItemType = ListItemType.AlternatingItem Then
> e.Item.Cells(2).Text = "My Text"
> End If
> End If
> End Sub
>
>Problem is there is a button in column 3 when this code fires it changes the button to a field with the text "My text".
Chris McCandless
Red Sky Software
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform