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

The current EditFormType does not support the requested editing capabilities

2 Answers 191 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 2
Dan asked on 10 Feb 2012, 10:34 PM
I have a RadGrid that is populated in the code-behind with a DataTable. The grid has an edit FormTemplate:
<telerik:RadGrid ID="rgFileList" runat="server" OnItemCommand="rgFileList_ItemCommand">
            <MasterTableView HorizontalAlign="Right">
                <EditFormSettings EditFormType="Template">
                    <FormTemplate>
                        <table style="width: 85%" align="center">
                            <tr>
                                <td style="width: 35%" align="right" >Description:  </td>
                                <td style="width: 65%">
                                    <asp:TextBox ID="txtDescription" runat="server" Text='<%# Bind("description") %>'></asp:TextBox>
                                </td>
                            </tr>
                            <tr><tdcolspan="2"> </td></tr>
                            <tr>
                                <td colspan="2" align="center">
                                    <asp:Button ID="btnUpdate" runat="server" Text="Update" CommandName="Update" />
                                    <asp:Button ID="btnCancel" runat="server" Text="Cancel" CommandName="Cancel" />
                                </td>
                            </tr>
                        </table>
                    </FormTemplate>
                </EditFormSettings>

When I click the 'Edit' button on a row, the edit form pops up, I enter the Description textbox, and click the Update button.  Control goes to

rgFileList_ItemCommand where the code is:

protected void rgFileList_ItemCommand(object source, GridCommandEventArgs e)
    {
        string strCommand = e.CommandName.ToUpper().Trim();
 
        if (strCommand == "UPDATE")
        {
            GridEditableItem grdSelected = (GridEditableItem)e.Item;
            string filename = grdSelected.GetDataKeyValue("filename").ToString().Trim();
 
            TextBox tb = (TextBox)grdSelected.FindControl("txtDescription");
            string description = tb.Text.ToString().Trim();


the problem is that the TextBox value is the original value of description for that row, not the new value typed into the textbox.  Why?  Can't figure out why it does not result in the new value.
The GridEditableItem grdSelected object is showing:

EditManager = 'grdSelected.EditManager' threw an exception of type 'Telerik.Web.UI.GridBindingException'GridEditableItem

{"The current EditFormType does not support the requested editing capabilities."}

2 Answers, 1 is accepted

Sort by
0
Accepted
Tsvetoslav
Telerik team
answered on 14 Feb 2012, 10:16 AM
Hello Dan,

I am not quite sure what might be the reason for the behavior you are experiencing but the best way to get the new values from the edit form is to use the editable item's ExtractValues method, passing to it a Hashtable object. The hash table will be populated with a column/values pairs collection.

Hope it helps.
 
All the best,
Tsvetoslav
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Dan
Top achievements
Rank 2
answered on 14 Feb 2012, 04:16 PM
Thank you for the reply.  I found that it was my mistake.  When submitting the update, the Page_Load was rebinding the grid's DataTable.  So, the FormTemplate data entry was zapped.  I just had to rebind only on initial page load.

Dan
Tags
Grid
Asked by
Dan
Top achievements
Rank 2
Answers by
Tsvetoslav
Telerik team
Dan
Top achievements
Rank 2
Share this question
or