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

Programmatic RadGrid and Inserting/Updating events not firing

1 Answer 132 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Todd
Top achievements
Rank 1
Todd asked on 30 Jan 2009, 09:03 PM
I am dynammically creating a RadGrid on a Web User Control that is also added to the web form dynamically.  I am calling DataBind() after each RadGrid creation on PageLoad and not utilizing NeedDataSource.  I am trying to insert/update in an automatically generated edit form, which is rendering nicely, except that the Insert and Update Commands are not firing.  I wish to catch the Insert and Update Commands to perform the record insert/updates - but those events are not firing after clicking on the insert and update links on the edit forms.  I cannot use any Automatic inserting or updating and wish to perform the CRUD methods manually.  Am I expecting too much from this control to handle all of this runtime generation?

                RadGrid radgrid = new RadGrid();
                radgrid.ID = "uc_attributeValues" + categoryAttributeID;
                radgrid.MasterTableView.DataKeyNames = new string[] { "KeepHistoryGroupID" };
                radgrid.AutoGenerateColumns = false;
                radgrid.Skin = "Vista";
                radgrid.Width = Unit.Percentage(95);
                radgrid.EnableViewState = true;
                radgrid.AllowAutomaticInserts = false;
                radgrid.AllowAutomaticUpdates = false;
                radgrid.AllowAutomaticDeletes = false;
                radgrid.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;
                radgrid.ItemCommand += new GridCommandEventHandler(radgrid_ItemCommand);
                radgrid.ClientSettings.Selecting.AllowRowSelect = true;
                radgrid.UpdateCommand += new GridCommandEventHandler(radgrid_UpdateCommand);
                radgrid.InsertCommand += new GridCommandEventHandler(radgrid_InsertCommand);


1 Answer, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 02 Feb 2009, 08:03 AM
Hello Todd,

Can you tell us why you cannot use NeedDataSource event?
If you supply RadGrid.DataSource on that event instead explicitly call DataBind you will be able easily handle all Insert/Update/Delete commands.

Secondly can you show you us the code when you call DataBind on RadGrid?

All the best,
Nikolay
the Telerik team

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