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

change create button title

1 Answer 88 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Trinh Nguyen
Top achievements
Rank 1
Trinh Nguyen asked on 16 Aug 2010, 06:52 PM
Hi there,
When I use this code:
protected void RadGridPhaseGroup_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridCommandItem)
        {
            LinkButton addButton = e.Item.FindControl("InitInsertButton") as LinkButton;
            addButton.Text = "Add new group";
        }
    }

It will change my add new item button name. However, I'm using the hierarchy grid. Are there any ways that i would be able to change the add button name of the outer grid to " Add new group" and the title of the add button name of the inner grid to "Add phase"?
The code above change the add button title for both the outer and inner grid.
Thanks in advance

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 17 Aug 2010, 04:59 AM
Hello,


By using Name property of 'GridTableView', it is possible to distinguish between the rows in hierarchy.
Distinguish grid rows in hierarchy on ItemCreated/ItemDataBound

A better option in changing the "Add new record" button text is setting the property for MasterTable and for DetailTable.
ASPX:
<telerik:RadGrid ID="RadGrid1" TabIndex="1" ShowGroupPanel="True" AllowMultiRowSelection="true">
     <MasterTableView TableLayout="Fixed" AllowMultiColumnSorting="True" CommandItemDisplay="Top"
        DataKeyNames="CustomerID" DataSourceID="SqlDataSource1" Width="100%" Name="Master">
        <CommandItemSettings AddNewRecordText="Add new group" />
        <DetailTables>
            <telerik:GridTableView Caption="Detail Table" DataKeyNames="OrderID" NoDetailRecordsText=""
                Name="Detail" DataSourceID="SqlDataSource2" CommandItemDisplay="Top" Width="100%"
                runat="server">
                <CommandItemSettings AddNewRecordText="inner" />



-Shinu.
Tags
Grid
Asked by
Trinh Nguyen
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or