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

changing grid header text

2 Answers 66 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Webster Velasco
Top achievements
Rank 2
Webster Velasco asked on 04 Dec 2009, 12:52 PM
hi.

i want to know if there is any methods to change my default header text value during my itemcreated events?.

regards
webster

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 04 Dec 2009, 01:10 PM
Hello Webster,

Check out the following link which explains on how to customize your grid header. This should probably help you:

Thanks
Shinu.
0
Webster Velasco
Top achievements
Rank 2
answered on 04 Dec 2009, 02:19 PM
thanks.. your suggestion has solved one of my problem..

i have a second problem where my radgrid is inside a <asp:content> controls..
this asp contend is related on my cotentplaceholder..

now i want to change the header using a method like this

    Public Function ImpostaCampiZoom(ByRef Pagina As Page, ByVal NomePagina As String) As String 
 
        ' imposta label del campi della pagina 
        TestoMessaggio = "" 
        ImpostaCampiZoom = "" 
 
        Dim c As Control 
        Dim childc As Control 
        Dim colGrid As String 
        Dim colHeader As Telerik.Web.UI.GridColumn 
 
        ApriConnessioni() 
        ReDim param(0 To 1) 
        ReDim paramVal(0 To 1) 
        param(0) = "CODICELINGUA" 
        param(1) = "NOMEPAGINA" 
        paramVal(0) = UTE_Lingua 
        paramVal(1) = NomePagina 
 
        EseguiStored("Pagina_Lingua", param, paramVal, kDataReader) 
 
        'ChiudiConnessioni() 
 
        If TestoMessaggio.Length > 0 Then 
            ImpostaCampiZoom = TestoMessaggio 
            ChiudiConnessioni() 
            Exit Function 
        End If 
 
        Try 
            With DR 
                Do Until .Read = False 
                    Pagina.Title = Nz(.GetValue(.GetOrdinal("TITOLOPAGINA")), "") 
                    colGrid = Nz(.GetValue(.GetOrdinal("CODICECAMPO")), "") 
                    For Each c In Pagina.Controls 
                        For Each childc In c.Controls 
                            If TypeOf childc Is Label Then 
                                If CType(childc, Label).ID = colGrid Then 
                                    CType(childc, Label).Text = Nz(.GetValue(.GetOrdinal("LABELCAMPO")), "") 
                                    CType(childc, Label).ToolTip = Nz(.GetValue(.GetOrdinal("HELPCAMPO")), "") 
                                Else 
                                    If CType(childc, Label).ID = "lblTitoloElenco" Then 
                                        CType(childc, Label).Text = Nz(.GetValue(.GetOrdinal("TITOLOPAGINA")), "") 
                                    End If 
                                End If 
                            ElseIf TypeOf childc Is Telerik.Web.UI.RadGrid Then 
                                colHeader = CType(childc, Telerik.Web.UI.RadGrid).MasterTableView.Columns.FindByUniqueName(colGrid) 
                                colHeader.HeaderText = Nz(.GetValue(.GetOrdinal("LABELCAMPO")), "") 
                            ElseIf TypeOf childc Is HtmlInputHidden Then 
                                If CType(childc, HtmlInputHidden).ID = "lblHelpPagina" Then 
                                    CType(childc, HtmlInputHidden).Value = Nz(.GetValue(.GetOrdinal("HELPPAGINA")), "") 
                                End If 
                            End If 
                        Next 
                    Next 
                Loop 
            End With 
            ChiudiConnessioni() 
 
        Catch _err As Exception 
            TestoMessaggio = "Errore etichette / Errors label - " + _err.Source + "->" + _err.Message 
        End Try 
 
    End Function 
 

function call:
ImpostaCampiZoom(Page, "Zoom") 




Tags
Grid
Asked by
Webster Velasco
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Webster Velasco
Top achievements
Rank 2
Share this question
or