Child Template Colour

3 posts, 1 answers
  1. Shan
    Shan avatar
    3 posts
    Member since:
    Dec 2014

    Posted 26 Dec 2014 Link to this post

    I am working with the Rad gridview with Two Child Templates.I want to the Row Formatting  for my ViewTemplates, So I used this Code ,

    Private Sub RadGrid_RowFormatting1(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.RowFormattingEventArgs) Handles RadGrid.RowFormatting

            If e.RowElement.ViewTemplate.Parent IsNot Nothing Then
                e.RowElement.ForeColor = Color.Blue
                e.RowElement.BackColor = Color.SkyBlue
            End If

    Yes..its working ..Is there any way to give alternative colour to the second child template..I want to differentiate the colour between second template to first template.
  2. Answer
    Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 26 Dec 2014 Link to this post

    Hi Shan,

    Each template has a Caption property, which you can set. Then you can use it in the formatting to determine which template the row is:
    Private Sub radGridView1_RowFormatting(sender As Object, e As RowFormattingEventArgs)
        If e.RowElement.ViewTemplate.Caption = "yourTemplate1Captioin" Then
            e.RowElement.ForeColor = Color.Red
        ElseIf e.RowElement.ViewTemplate.Caption = "yourTemplate1Captioin" Then
            e.RowElement.ForeColor = Color.Purple
        Else
            e.RowElement.ResetValue(LightVisualElement.ForeColorProperty, ValueResetFlags.Local)
        End If
    End Sub

    Alternatively, you can put some identifier in the Tag property and use it instead.

    I hope that you find this information useful. Should you have any other questions, do not hesitate to contact us.

    Regards,
    Stefan
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. Shan
    Shan avatar
    3 posts
    Member since:
    Dec 2014

    Posted 26 Dec 2014 in reply to Stefan Link to this post

    Thank You Mr.Stefan...Its working Perfectly . Great Support.
Back to Top