This is a migrated thread and some comments may be shown as answers.

Adding Literals to newest updated grids

1 Answer 56 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kyle Butler
Top achievements
Rank 2
Kyle Butler asked on 08 Dec 2011, 12:04 AM
I can't seem to get my old code for adding a literal to the new grid control I updated yesterday (in my case a message that customer 123 was deleted when done so). Is there a different way or something I'm missing? Here's the code:
Private Sub DisplayMessage(text As String)
        grdList.Controls.AddAt(0, New LiteralControl(String.Format("<span style='color:red'>{0}</span>", text)))
    End Sub

Thanks for any help in advanced!

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 08 Dec 2011, 04:38 AM
Hello Kyle,

Try the following code.
VB:
Protected Sub RadGrid1_ItemDataBound(sender As Object, e As Telerik.Web.UI.GridItemEventArgs)
    If TypeOf e.Item Is GridDataItem Then
        Dim item As GridDataItem = DirectCast(e.Item, GridDataItem)
        Dim cell As TableCell = DirectCast(item("UniqueName"), TableCell)
        Dim ltl As New Literal()
        ltl.ID = "Literal1"
        ltl.Text = "Text"
        cell.Controls.Add(ltl)
    End If
End Sub

-Shinu.
Tags
Grid
Asked by
Kyle Butler
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Share this question
or