Hi, I am using entity framework, ObjectDataSource and an object class to bind RadGrid. I want to access some of the controls in the edit form from the Object Data souce inserting event but need some help with this. I know i have to access GridEditFormInsertItem somehow to access the control but I dont know how to reach it from the object Data source inserting event. So far all the examples I have seen are like
This is really what I want to do...but from the ObjectDataSource Inserting event since I need to add an insert parameter for the object class my objectDatasource is tied to....I have tried to access the GridCommandEventArgs or the GridEditFormInsertItem like below but no luck so far... can someone please show me how to do this?
}
protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
if ((e.CommandName == RadGrid.PerformInsertCommandName))
{
//the dropdown list will be the first control in the Controls collection of the corresponding cell
DropDownList list = (e.Item as GridEditableItem)["ddlContactName"].Controls[0] as DropDownList;
}
}
This is really what I want to do...but from the ObjectDataSource Inserting event since I need to add an insert parameter for the object class my objectDatasource is tied to....I have tried to access the GridCommandEventArgs or the GridEditFormInsertItem like below but no luck so far... can someone please show me how to do this?
protected void ObjectDataSource1_Inserting(object sender, System.Web.UI.WebControls.ObjectDataSourceMethodEventArgs e)
{
((DAL.DTO.DataTypeObject)e.InputParameters[0]).product.product_id = (int)Session["CustomerID"];
//These dont work...how can I access my Edit form or GridCommandEventArgs from this event in objectDatasource
//inserting event to access my dropdownlist??
//Telerik.Web.UI.GridEditFormInsertItem myInsertForm = ((Telerik.Web.UI.GridEditFormInsertItem)RadGrid1.FindControl("EditFormControl"));
//Telerik.Web.UI.GridEditFormInsertItem myInsertForm = ((Telerik.Web.UI.GridEditFormInsertItem)RadGrid1.EditItems[0]);
}