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

Accessing Group Header Item from Client Side

2 Answers 128 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Preetam Ray
Top achievements
Rank 1
Preetam Ray asked on 13 Aug 2008, 02:35 PM
Hi,
    Can anyone let me know how to access the Group Header item of rad grid from client side so that i will be able to change the text of it? I am using rad controls for asp.net ajax.

Please let me know as early as possible bcos it is of high importance.

Thanks,
Preetam.

2 Answers, 1 is accepted

Sort by
0
Preetam Ray
Top achievements
Rank 1
answered on 14 Aug 2008, 04:32 AM
Hi,
    Can anyone from telerik team post a reply to this?I am got stuck in this for quite long time and i expect some help to proceed further.

Please let me know the resolution for this as soon as possible.

Thanks,
Preetam.
0
Yavor
Telerik team
answered on 15 Aug 2008, 06:35 AM
Hello Preetam,

One possible approach is shown in the code below:

.aspx
  <rad:RadGrid ID="RadGrid1" runat="server" DataSourceID="AccessDataSource1" GridLines="None">  
            <MasterTableView AutoGenerateColumns="False" DataKeyNames="CustomerID" DataSourceID="AccessDataSource1">  
              
            <GroupByExpressions> 
            <rad:GridGroupByExpression> 
            <GroupByFields> 
            <rad:GridGroupByField FieldName="CustomerID" FieldAlias="CustomerID" FormatString="" HeaderText="" /> 
            </GroupByFields> 
            <SelectFields> 
            <rad:GridGroupByField FieldName="CustomerID" FieldAlias="CustomerID" FormatString="" HeaderText="" /> 
            </SelectFields> 
            </rad:GridGroupByExpression> 
            </GroupByExpressions> 
              
                <RowIndicatorColumn Visible="False">  
                    <HeaderStyle Width="20px" /> 
                </RowIndicatorColumn> 
                <ExpandCollapseColumn Resizable="False" Visible="False">  
                    <HeaderStyle Width="20px" /> 
                </ExpandCollapseColumn> 
                <Columns> 
                    <rad:GridBoundColumn DataField="CustomerID" HeaderText="CustomerID" ReadOnly="True" 
                        SortExpression="CustomerID" UniqueName="CustomerID">  
                    </rad:GridBoundColumn> 
                    <rad:GridBoundColumn DataField="CompanyName" HeaderText="CompanyName" SortExpression="CompanyName" 
                        UniqueName="CompanyName">  
                    </rad:GridBoundColumn> 
                    <rad:GridBoundColumn DataField="ContactName" HeaderText="ContactName" SortExpression="ContactName" 
                        UniqueName="ContactName">  
                    </rad:GridBoundColumn> 
                    <rad:GridBoundColumn DataField="ContactTitle" HeaderText="ContactTitle" SortExpression="ContactTitle" 
                        UniqueName="ContactTitle">  
                    </rad:GridBoundColumn> 
                    <rad:GridBoundColumn DataField="Address" HeaderText="Address" SortExpression="Address" 
                        UniqueName="Address">  
                    </rad:GridBoundColumn> 
                </Columns> 
            </MasterTableView> 
              
            <ClientSettings> 
            <ClientEvents OnGridCreated="GridCreated" /> 
                <Selecting AllowRowSelect="True" /> 
            </ClientSettings> 
              
        </rad:RadGrid><asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/Nwind.mdb" 
            SelectCommand="SELECT TOP 10 [CustomerID], [CompanyName], [ContactName], [ContactTitle], [Address] FROM [Customers]">  
        </asp:AccessDataSource> 

.Js
<script type="text/javascript">  
      
            function GridCreated()  
            {              
            var groupHeaders = document.getElementsByTagName("tr");  
                    
                for (var i=0; i<groupHeaders.length; i++)  
                {  
                    if(groupHeaders[i].className=="GroupHeader_Default")  
                    {  
                    //manipulate the group header element groupHeaders[i] here  
                    }  
                }  
              
            }  
      
        </script> 

I hope this helps.

Regards,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Preetam Ray
Top achievements
Rank 1
Answers by
Preetam Ray
Top achievements
Rank 1
Yavor
Telerik team
Share this question
or