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

change RadGrid Insert and Cancel links at the bottom if EditItem

1 Answer 30 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Stoyan
Top achievements
Rank 1
Stoyan asked on 10 Dec 2013, 03:12 PM

Would you please let me know how to change the Insert and Cancel at the bottom of Edit to be something else

maybe button or image button link







Here is what I want to change



http://www.prikachi.com/images/262/6838262D.jpg



1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 11 Dec 2013, 06:13 AM
Hi Stoyan,

I guess you want to change the Insert/Update and Cancel LinkButtons to ImageButton. Please try the following code snippet.

C#:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
    if (e.Item is GridEditableItem && e.Item.IsInEditMode)
    {
        if (e.Item.OwnerTableView.IsItemInserted)
        {
            LinkButton insertButton = (LinkButton)e.Item.FindControl("PerformInsertButton");
            insertButton.Visible = false;
            ImageButton insertBtn = new ImageButton();
            insertBtn.CommandName = "PerformInsert";
            insertBtn.ToolTip = "Insert";
            insertBtn.ImageUrl = "Insertimg.jpg";
            insertButton.Parent.Controls.Add(insertBtn);
            insertButton.Parent.Controls.Add(new LiteralControl(" "));
 
        }
        else
        {
            LinkButton updateButton = (LinkButton)e.Item.FindControl("UpdateButton");
            updateButton.Visible = false;
            ImageButton update = new ImageButton();
            update.CommandName = "Update";
            update.ToolTip = "Update";
            update.ImageUrl = "Updateimg.jpg";
            updateButton.Parent.Controls.Add(update);
            updateButton.Parent.Controls.Add(new LiteralControl(" "));
        }
        LinkButton cancelButton = (LinkButton)e.Item.FindControl("CancelButton");
        cancelButton.Visible = false;
        ImageButton cancelbtn = new ImageButton();
        cancelbtn.CommandName = "Cancel";
        cancelbtn.ToolTip = "Cancel";
        cancelbtn.ImageUrl = "Cancelimg.jpg";
        cancelButton.Parent.Controls.Add(cancelbtn);
    }
}

Thanks,
Shinu
Tags
Grid
Asked by
Stoyan
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or