Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Button control text
Message
 
To
02/03/2004 17:52:17
General information
Forum:
ASP.NET
Category:
WebForms
Miscellaneous
Thread ID:
00882451
Message ID:
00882544
Views:
17
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform