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

[Solved] Change delete/edit text on autogenerated columns

3 Answers 209 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jason Thacker
Top achievements
Rank 1
Jason Thacker asked on 26 Aug 2009, 08:16 PM
I am having trouble localizing a RADGrid. I have managed to localize the column headers and the command bar, but I cannot see how to localize the "built in" button names using a resource file.

I need to change the following:

"update" and "cancel" when editing a row using the built in form
"insert" and "cancel" when adding a row using the built in form
"delete" and "edit" on the autogenerated columns within the form itself

Does anybody have any ideas on the best way to accomplish this?

Thanks,

Jason

3 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 27 Aug 2009, 05:41 AM
Hello Jason,

Try out teh following code to localize
the Edit and Delete texts as shown below:
c#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)  
    {  
        if (e.Item is GridDataItem)  
        {  
            GridDataItem item = (GridDataItem)e.Item;  
            ((LinkButton)item["AutoGeneratedEditColumn"].Controls[0]).Text = GetLocalResourceObject("name1").ToString();;  
            ((LinkButton)item["AutoGeneratedDeleteColumn"].Controls[0]).Text = GetLocalResourceObject("name2").ToString();;  
        }  
    }  

 And to localize the Insert , Update and Cancel buttons, you can try out the following settings:
aspx:
 
    <telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1"   runat="server" AutoGenerateDeleteColumn="true" AutoGenerateEditColumn="true" OnItemDataBound="RadGrid1_ItemDataBound">  
                <MasterTableView DataSourceID="SqlDataSource1" EditMode="InPlace" CommandItemDisplay="Top">  
                      <EditFormSettings>  
                        <EditColumn UniqueName="EditCommandColumn1" InsertText='<$ Resources>' CancelText='<$ Resources>' UpdateText='<$ Resources>' >  
                        </EditColumn>  
                      </EditFormSettings>  
                         .... 

You can also refer to the following document for more information on this:
Localization through resource files

Thanks
Princy.
0
Jason Thacker
Top achievements
Rank 1
answered on 27 Aug 2009, 11:13 AM
Thanks Princy,

The firsts section of code worked just great, but with the second I just get <% Resources> being displayed. Do you know what I am doing wrong?

Jason
0
Jason Thacker
Top achievements
Rank 1
answered on 27 Aug 2009, 11:28 AM
Sorry, I figured it out. I can set them by  adding the following to my code once I have <$ Resources> in place:

 

RadGrid1.MasterTableView.EditFormSettings.EditColumn.InsertText = GetLocalResourceObject("ResourceName").ToString(); 

Thanks again!


Jason

 

Tags
Grid
Asked by
Jason Thacker
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Jason Thacker
Top achievements
Rank 1
Share this question
or