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

[Solved] Chnage the text of Edit, Update, Cancel link buttons

3 Answers 162 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Clive Hoggar
Top achievements
Rank 1
Clive Hoggar asked on 22 Jul 2009, 03:38 PM
Hi

I have a grid that uses the automatically generated Edit column edit form.
Can I modify the text of these link buttons in the automatic mode?

The documentation seemsto refer to the non-automatic case.

Thanks

Clive

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 23 Jul 2009, 04:28 AM
Hello Clive,

You can try out the following code to set a custom text for the AutoGeneratedEdit column:
c#:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    {       
       if (e.Item is GridDataItem) 
        { 
            GridDataItem item = (GridDataItem)e.Item; 
            ((LinkButton)item["AutoGeneratedEditColumn"].Controls[0]).Text = "CustomEdit";             
        } 
    } 

Thanks
Princy.
0
Clive Hoggar
Top achievements
Rank 1
answered on 23 Jul 2009, 10:38 AM
Princy,

Thank for quick answer.

I am working in vb so converted this to
Protected Sub RadGrid2_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs)  
        If TypeOf e.Item Is GridDataItem Then  
            Dim item As GridDataItem = DirectCast(e.Item, GridDataItem)  
            DirectCast(item("AutoGeneratedEditColumn").Controls(0), LinkButton).Text = "More" 
        End If  
    End Sub 
(Grid ID is RadGrid2 in my case)

There were no run-time errors, but it did not actually change the 'Edit' link so I am not sure where
 to go now. Does this vb look OK?.

Also how do I refer to the 'Update' and 'Cancel' links in the automatic edit form?

Clive
0
Daniel
Telerik team
answered on 24 Jul 2009, 12:40 PM
Hello Clive,

Please try the following approach (for EditForms mode):
Protected Sub RadGrid1_ItemCreated(sender As Object, e As GridItemEventArgs) 
    If TypeOf e.Item Is GridDataItem AndAlso Not e.Item.IsInEditMode Then 
        Dim edtBtn As LinkButton = TryCast(e.Item.FindControl("AutogeneratedEditButton"), LinkButton) 
        edtBtn.Text = "_edit_" 
    End If 
    If e.Item.IsInEditMode Then 
        Dim updBtn As LinkButton = TryCast(e.Item.FindControl("UpdateButton"), LinkButton) 
        Dim cncBtn As LinkButton = TryCast(e.Item.FindControl("CancelButton"), LinkButton) 
        updBtn.Text = "_update_" 
        cncBtn.Text = "_cancel_" 
    End If 
End Sub 

Note that the names of Update/Cancel buttons in InPlace mode are different:
Cancel: AutoGeneratedCancelButton
Update: AutoGeneratedUpdateButton

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Clive Hoggar
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Clive Hoggar
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or