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

add new record - InitInsertButton

1 Answer 136 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jomey
Top achievements
Rank 1
Jomey asked on 31 Jul 2008, 12:30 AM
When I hit the built in "Add new record" button in the header it works perfectly.  But there is a + (plus) icon on the left of "Add new record" -- when I hit that it behaves differently.  I want the plus icon to behave the same the Add new record.

    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridCommandItem)
        {
            GridCommandItem cmditm = (GridCommandItem)e.Item;
            LinkButton btn = (LinkButton)cmditm.FindControl("InitInsertButton");
            btn.Attributes.Add("OnClick", "return ShowInsertForm('Roles');");
        }
    }

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 31 Jul 2008, 08:30 AM
Hi Jomey,

As of Q1 2008 the "Add New" button in the command item consists of two buttons. This is skinning optimization purposes.

In order to address both buttons (image and link), please use:



    if (e.Item is GridCommandItem)
    {
        Button spriteAddButton = e.Item.FindControl("AddNewRecordButton") as Button;

        LinkButton addButton = e.Item.FindControl("InitInsertButton") as LinkButton;
    }



Sincerely yours,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Jomey
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or