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

DetailTable findcontrol on iniytinsert

1 Answer 63 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Said
Top achievements
Rank 1
Said asked on 02 May 2014, 03:37 PM
Hi everybody,
i want to populate a ComboBox that exist on the EditFormTemplate of a detailTable base on the ParentItem DataKeyValue, when the user click on the btn add new record, so here's my code :

public void radGrid_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName == RadGrid.InitInsertCommandName)
            {
                if (e.Item.OwnerTableView.Name == "ChildGrid")
                {
                    GridDataItem parentItem = (GridDataItem)(e.Item.OwnerTableView.ParentItem);
                   
                    if (parentItem != null)
                    {
                        int itemId= Convert.ToInt32(parentItem.OwnerTableView.DataKeyValues[parentItem.ItemIndex]["Id"]);
                        //i want to get here the ComboBox control and the code (as i think) should look like this :
                        RadComboBox = e.item.findControl("comboId") as RadComboBox;
                    }

                }
                
            }
        }

thanks.

1 Answer, 1 is accepted

Sort by
0
Said
Top achievements
Rank 1
answered on 02 May 2014, 04:24 PM
so i found it, if any one face's the same problem :
instead of using the OnItemCommand event i used the OnItemCreated the code is :

protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (e.Item.OwnerTableView.Name == "DetailTbleID" && e.Item is GridEditableItem && e.Item.IsInEditMode)
        {
            RadComboBox ddlMkt = e.Item.FindControl("comboCtrl") as RadComboBox;
 
        }
    }

and that worked, of course thx to this thread : http://www.telerik.com/forums/initinsert-get-created-edit-form
Tags
Grid
Asked by
Said
Top achievements
Rank 1
Answers by
Said
Top achievements
Rank 1
Share this question
or