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

ExtractValuesFromItem returning null values in InsertCommand

5 Answers 190 Views
Grid
This is a migrated thread and some comments may be shown as answers.
sohaiby
Top achievements
Rank 2
sohaiby asked on 19 Oct 2015, 12:49 PM

I have a telerik RadGrid. I have applied Manual CRUD operations in it. I am using In-Place editing mode. The problem is, when I am trying to Insert or Update the records, i am getting null values by this method 

e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem);

Same thing happening in both RadGrid_UpdateCommand and ​RadGrid_​InsertCommand

Following is my ASPX code

<telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
                    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
                    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                        <AjaxSettings>
                            <telerik:AjaxSetting AjaxControlID="rGrid">
                                <UpdatedControls>
                                    <telerik:AjaxUpdatedControl ControlID="rGrid" LoadingPanelID="RadAjaxLoadingPanel1" />
                                </UpdatedControls>
                            </telerik:AjaxSetting>
                        </AjaxSettings>
                    </telerik:RadAjaxManager>
                    <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1" />
                    <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecorationZoneID="demo" EnableRoundedCorners="false" DecoratedControls="All" />
 
                    <telerik:RadGrid ID="rGrid" runat="server" AllowPaging="True" PageSize="10"
                    AllowSorting="True" AutoGenerateColumns="false"
                    AllowFilteringByColumn="True" CellSpacing="0" GridLines="None"
                    OnNeedDataSource="rGrid_NeedDataSource" OnItemCreated="rGrid_ItemCreated"
                    OnPreRender="rGrid_PreRender" OnInsertCommand="rGrid_InsertCommand"
                    OnUpdateCommand="rGrid_UpdateCommand" ondeletecommand="rGrid_DeleteCommand">
                    <PagerStyle Mode="NextPrevAndNumeric" />
                    <GroupingSettings CaseSensitive="false" />
                    <MasterTableView DataKeyNames="ID" EditMode="InPlace" CommandItemDisplay="Top" InsertItemPageIndexAction="ShowItemOnCurrentPage">
                        <Columns>
                            <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn" HeaderText="Edit">
                            </telerik:GridEditCommandColumn>
                            <telerik:GridBoundColumn DataField="ID" UniqueName="ID" HeaderText="ID" ColumnEditorID="GridTextBoxEditor1" ReadOnly="true">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Name" UniqueName="Name" HeaderText="Name" ColumnEditorID="GridTextBoxEditor1">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="ContactPerson" UniqueName="ContactPerson" HeaderText="Contact Person" ColumnEditorID="GridTextBoxEditor2">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Address" UniqueName="Address" HeaderText="Address" ColumnEditorID="GridTextBoxEditor3">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Country" UniqueName="Country" HeaderText="Country" ColumnEditorID="GridTextBoxEditor4">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="City" UniqueName="City" HeaderText="City" ColumnEditorID="GridTextBoxEditor5">
                            </telerik:GridBoundColumn
                            <telerik:GridBoundColumn DataField="Phone" UniqueName="Phone" HeaderText="Phone" ColumnEditorID="GridTextBoxEditor6">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Email" UniqueName="Email" HeaderText="Email" ColumnEditorID="GridTextBoxEditor7">
                            </telerik:GridBoundColumn>
                            <telerik:GridClientDeleteColumn HeaderText="Delete" ButtonType="ImageButton">
                            <%--<telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow"
                            ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" />--%>
                            <HeaderStyle Width="70px" />
                        </telerik:GridClientDeleteColumn>
                        </Columns>
                        <EditFormSettings>
                            <EditColumn ButtonType="ImageButton" />
                        </EditFormSettings>
                    </MasterTableView>
                <ClientSettings>
                    <ClientEvents OnUserAction="UserAction" />
                </ClientSettings>
                </telerik:RadGrid>

Following is Code behind

public partial class Suppliers : System.Web.UI.Page
   {
       protected void Page_Load(object sender, EventArgs e)
       {
           if (!IsPostBack)
           {
                
           }
       }
 
       protected void rGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
       {
           Code.BLL.Suppliers objSuppliers = new Code.BLL.Suppliers();
           List<Code.BLL.Suppliers> lstSupplier = objSuppliers.Load();
 
           rGrid.DataSource = lstSupplier;
       }
 
       protected void rGrid_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
       {
 
       }​
 
       protected void rGrid_PreRender(object sender, EventArgs e)
       {
       }
 
       protected void rGrid_InsertCommand(object sender, GridCommandEventArgs e)
       {
           GridEditableItem editedItem = e.Item as GridEditableItem;
 
           Hashtable newValues = new Hashtable();
           e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem);
           //editedItem.ExtractValues(newValues); I have tried both methods, but got null values from both
       }
 
       protected void rGrid_UpdateCommand(object sender, GridCommandEventArgs e)
       {
           GridEditableItem editedItem = e.Item as GridEditableItem;
 
           //Prepare new dictionary object
           Hashtable newValues = new Hashtable();
           e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem);
           editedItem.ExtractValues(newValues);I have tried both methods, but got null values from both
 
       }
 
       protected void rGrid_DeleteCommand(object sender, GridCommandEventArgs e)
       {
 
       }
   }

5 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 22 Oct 2015, 12:08 PM
Hello,

I tested the online demo bellow by setting InPlace edit mode and it works properly on my end:
http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/manual-crud-operations/defaultcs.aspx

Test it on your end and verify what the difrenace in your case is.

Regards,
Maria Ilieva
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Ralph
Top achievements
Rank 1
answered on 11 Oct 2016, 03:02 PM

Sorry.. but it's time for an editorial comment and one that is LONG overdue....

<<Test it on your end and verify what the difrenace (sp) in your case is.>>

I am SO SICK AND TIRED of this poor quality of reply and information from literally hundreds of Telerik Support "Analysts".

I am involved on a long term task of replacing an infragistics grid that was retired back in 2011 with the Telerik radGrid, and I have received this very same reply over and over and over again. Their forums are full of this; their direct support seems to have all the intelligence, logic, and tech capabilities of a  VERY OLD copy of 'Eliza', for gosh sake...

Everything I've been able to discern on this software has been by wickedly expensive 'trial and error', and it saddens me to see, by the thousands of posts above, that I'm not the only one suffering from this nonsense.

People are PAYING for telerik support; there is little to no other source of information available on this control (and that's probably by design,as well): How do you people expect clients to keep USING your software, if you treat them like this?

A coworker reports it's the very same situation when she tries to get support for your Kendo MVC stuff, as well....

Can SOMEONE at Telerik please explain to me why you all seem to have such a VERY LOW opinion of your clients and the value of their projects???

ARRRRRRRRRRRRRRRRRRRRGGGGGGGGGGGGGGGHHHHHHHHHHHHHHHHHHHH!!!

 

0
Dimo
Telerik team
answered on 14 Oct 2016, 08:21 AM
Hello Ralph,

My name is Dimo Dimov and I am the support lead for the UI for ASP.NET AJAX product.

I regret to find out that you are disappointed by the experience you have so far with our support service.

I reviewed your support history and found two support threads. Both of them are now resolved and we have a better picture of the situations. From this point of view, I can confirm that in both cases the issues were caused by implementation specifics that we were initially unaware of. In such cases, it is a standard practice to either ask for more information, or send a working example for customer review and comparison. Providing a test project and suggesting to modify it until the issue is reproduced is a combination of the two options that has proven to be effective and we indeed use it. It spares time for the client to prepare an isolated test project from scratch, and also minimizes the guesswork on our end, which is likely to bring no benefit or progress, but only cause message round-trips.

I want to assure you that we are always doing our best to provide helpful answers based on the information we have.

With regard the expressed concerns about lack of enough help resources, the UI for ASP.NET AJAX suite is one of our most mature products, so it also has the most extensive amount of help resources, including:

- Documentation http://docs.telerik.com/devtools/aspnet-ajax/introduction
- Demos http://demos.telerik.com/aspnet-ajax/
- Code Library http://www.telerik.com/support/code-library/aspnet-ajax
- A “how-to” section under each control section in the documentation. There is no specific landing page that I can link, but here is one article from the “how-to” section of the Grid
http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/how-to/Other-resources


We will appreciate and review any specific feedback on help resources that you believe need improvement.

===

Regarding the issue discussed in this thread - we took the opportunity and prepared a sample test project based on the provided code. The ExtractValuesFromItem method inside InsertCommand and UpdateCommand events is returning the correct values. Here is a video:

http://screencast.com/t/O1WKLxkUsB

The test page is attached to this post for your convenience. Please check it out and let me know what is the difference on your end and if it helps to resolve the problem with null values you encounter.

In case the issue still exists please send us a similar isolated project where the problem can be observed, so we can debug it locally and provide a solution or further suggestions.

Regards,
Dimo
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Ralph
Top achievements
Rank 1
answered on 21 Nov 2016, 08:18 PM

I'll check out your extractValuesFromItem test project - that's a huge issue; i've seen over 50 posts of people having difficulty with that.

Yes, two support incidents: both of them solved by myself, after HOURS of google research. 

I just wish I could go to your links and find that information in one spot - written for clients and not assuming massive amounts of developer information, but I cannot.  Perhaps I am spoiled by other controls, where I can reference a class, find a complete, in one place, list of properties, events, and methods, and drill down into them and find answers all in one place. 

that's been incredibly difficult to do with telerik products

 

0
Dimo
Telerik team
answered on 23 Nov 2016, 08:49 AM
Hello Ralph,

We appreciate your feedback and will gladly review any competitor's documentation that you believe is easy to use. Any other suggestions are always welcome.

Currently, the UI for ASP.NET AJAX API is documented per control, in the "Server-side programming" and "Client-side programming" sections, for example:

http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/server-side-programming/overview

http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/client-side-programming/overview

Intellisense can also be used for reference, including one for the JavaScript code:

http://docs.telerik.com/devtools/aspnet-ajax/general-information/integration-with-visual-studio/how-to-use-javascript-intellisense-for-the-telerik-controls

Regards,
Dimo
Telerik by Progress
Telerik UI for ASP.NET AJAX is ready for Visual Studio 2017 RC! Learn more.
Tags
Grid
Asked by
sohaiby
Top achievements
Rank 2
Answers by
Maria Ilieva
Telerik team
Ralph
Top achievements
Rank 1
Dimo
Telerik team
Share this question
or