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

RadGrid with AllowAutomaticUpdates from a DataTable in runtime

1 Answer 267 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
cs981khx asked on 01 Sep 2010, 11:14 AM
Hi all,

I have a CSV file that is selected and read using the RadUpload control. I read each line and populate a DataTable on a C# ASP.NET webpage. Once that is done, I used a RadGrid to populate those values into the grid with AutoGenerateColumns="True"

The rows that don't comply are highlighted in red on RadGrid1_ItemDataBound event, so that user know that they need to be changed.

Now I want the user to go and edit each invalid row and update the changes. Currently with AllowAutomaticUpdates="True" is it not letting me save anything, it just displays the same information when Update is clicked. I am not using an SQL Data Souce so the first question is whether AllowAutomaticUpdates does actually work with just a DataTable or not? If not any suggestion on how I can make the row update-able with minimum coding.

Many thanks

Mark up code is below:
<telerik:RadScriptManager ID="RadScriptManager1" runat="server"> </telerik:RadScriptManager>
<telerik:RadFormDecorator ID="RadFormDecorator1" Runat="server" Skin="Forest" DecoratedControls="All" />
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
<telerik:RadGrid ID="RadGrid1" runat="server" AllowAutomaticDeletes="True"
    AllowAutomaticUpdates="True" GridLines="None"
    AutoGenerateColumns="True" Skin="Forest"  Width="90%" Height="300px"
    onitemupdated="RadGrid1_ItemUpdated" VirtualItemCount="1">
    <MasterTableView EditMode="InPlace" EnableNoRecordsTemplate="False"
        InsertItemPageIndexAction="ShowItemOnFirstPage" DataKeyNames="LineNo" CommandItemDisplay="None">
            <EditColumn UniqueName="EditCommandColumn1">
            <Scrolling AllowScroll="True" UseStaticHeaders="True" />

1 Answer, 1 is accepted

Sort by
Top achievements
Rank 2
answered on 01 Sep 2010, 12:44 PM

Its not possible to perform Automatic DataSource operations on DataTable. The automatic data source operations only work when binding the grid to a declarative data source using the DataSourceID property of the grid. You can take the following Code Libraray which explains how to  perform manual insert/update/delete operation as a reference.

Manual Insert/Update/Delete operations using Auto-generated editform with sql statements from the code-behind:

Asked by
Top achievements
Rank 1
Answers by
Top achievements
Rank 2
Share this question