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

changing Edit button text in runntime

3 Answers 236 Views
Grid
This is a migrated thread and some comments may be shown as answers.
komathi priya
Top achievements
Rank 1
komathi priya asked on 17 Aug 2010, 08:34 AM
hi,


i want to give text to edit button in the coding , also i want to change the name depending on my need, all i have to do in the coding
How to give name to the PushButton button in the GridEditCommandColumn  (in coding)

<telerik:GridEditCommandColumn  UniqueName="EditCommandColumn1"  
         ButtonType="PushButton" EditText="Reload"    HeaderStyle-Width="9%">
 </telerik:GridEditCommandColumn>


actually how to change the EditText="Reload" to some other name,

regards
priya

3 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 17 Aug 2010, 09:59 AM
Hello Priya,

You can try the following code snippet in ItemDataBound event to change the Text of Button.

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
       if (e.Item is GridDataItem)
        {
            GridDataItem item=(GridDataItem)e.Item;
            Button btn = (Button)item["EditCommandColumn1"].Controls[0];
            btn.Text = "new Button text"; // changing Button Text
        }
   }

Thanks,
Princy.
0
komathi priya
Top achievements
Rank 1
answered on 17 Aug 2010, 10:16 AM
hi,

i'm getting text as Edit only.

i'm repeating i want to change the telerik:GridEditCommandColumn, pushbutton text

<telerik:GridEditCommandColumn  UniqueName="EditCommandColumn1"  
         ButtonType="PushButton"  HeaderStyle-Width="9%">
 </telerik:GridEditCommandColumn>


please i'm in need for this immediately

regards
priya
0
Accepted
Princy
Top achievements
Rank 2
answered on 18 Aug 2010, 02:56 PM
Hello Priya,


I am not sure what is happening at your end, since the code worked perfectly for me (I'm able to change the text). Have you attached ItemDataBound event to grid?  If so please make sure that the event fires and the code executes properly.

Feel free to share the comments,


Thanks,
Princy.
Tags
Grid
Asked by
komathi priya
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
komathi priya
Top achievements
Rank 1
Share this question
or