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

GridEditFormItem CanExtractValues = false

3 Answers 124 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Louis-Philippe
Top achievements
Rank 1
Louis-Philippe asked on 08 Mar 2011, 09:41 PM
Hello,
I'm using a WebUserControl to edit/insert data into my radgrid. I experience some inconsistent behavior when I tried to access the data inside my WebUserControl. The way I access the data  is

GridEditFormItem editedItem = (GridEditFormItem)_radgNiv3.MasterTableView.GetItems(GridItemType.EditFormItem)[0];
 
if (editedItem.CanExtractValues)
{
       UserControl userControl = (UserControl)editedItem.FindControl(GridEditFormItem.EditFormUserControlID);
...

The update/insert operation can be initiate from different control in the page, so it doesn't always go through the ItemCommand event of my radgrid. Every control that can initiate an update/insert is using ajax. Here's a part to illustrate the situation

  <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="_lbtnAdd">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="_radgrig"
                    LoadingPanelID="RadAjaxLoadingPanel1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
...

_lbtnAdd is a LinkButton. If _radgrig is in edit mode and the user click on _lbtnAdd, I'm suppose to check for modification than act accordingly. But, code that work in other situation, doesn't work here, editedItem.CanExtractValues = false. Of course, if I tried to find my form, it stays null. Looking inside of editedItem, I can see that there is an exception inside the object:
EditManager   'editedItem.EditManager' threw an exception of type 'Telerik.Web.UI.GridBindingException'   Telerik.Web.UI.GridEditManager {Telerik.Web.UI.GridBindingException}

Going deeper, reveal:
base   {"The current EditFormType does not support the requested editing capabilities."}   System.Exception {Telerik.Web.UI.GridBindingException}

This one is driving me nuts since it come and go. How can I make sure to always be able to access the data? What can cause the exception? Is it related to event order? Please help!!!

Thank you for your time,
Louis-Philippe

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 09 Mar 2011, 09:14 AM
Hello Louis,

Try the following approach to access the EditForm UserControl.

C#:
protected void _lbtnAdd_Click(object sender, EventArgs e)
  {
      int index =Convert.ToInt32(RadGridDocuments.EditIndexes[0]);
      GridEditFormItem editedItem = (GridEditFormItem)RadGridDocuments.MasterTableView.GetItems(GridItemType.EditFormItem)[index];
      UserControl userControl = (UserControl)editedItem.FindControl(GridEditFormItem.EditFormUserControlID);
  }

Thanks,
Princy.
0
Louis-Philippe
Top achievements
Rank 1
answered on 09 Mar 2011, 02:37 PM
Hello Princy,
Thanks for the quick reply. I tried your solution, but no luck.. Actually, I already tried to go through all item just in case, but CanExtractValues always equal false. Any other ideas? What can cause the data to be inaccessible?

Thank you for your help,
Louis-Philippe
0
Louis-Philippe
Top achievements
Rank 1
answered on 09 Mar 2011, 04:06 PM
Ok this one is just weird!!! I want back to a previous working version and than merge the two together and it work just fine. The only difference between the files are empty lines and code I added to try to patch the bugs. Can Visual Studio 2010 add some invisible character that corrupt the data? It just doesn't make any sens...

Louis-Philippe
Tags
Grid
Asked by
Louis-Philippe
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Louis-Philippe
Top achievements
Rank 1
Share this question
or