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

RadGrid with AllowAutomaticUpdates from a DataTable in runtime

1 Answer 240 Views
Grid
This is a migrated thread and some comments may be shown as answers.
cs981khx
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">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadGrid1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<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"
    onitemdatabound="RadGrid1_ItemDataBound"
    onneeddatasource="RadGrid1_NeedDataSource"
    onitemupdated="RadGrid1_ItemUpdated" VirtualItemCount="1">
     
    <MasterTableView EditMode="InPlace" EnableNoRecordsTemplate="False"
        InsertItemPageIndexAction="ShowItemOnFirstPage" DataKeyNames="LineNo" CommandItemDisplay="None">
        <Columns>
            <telerik:GridEditCommandColumn></telerik:GridEditCommandColumn>
        </Columns>
        <EditFormSettings>
            <EditColumn UniqueName="EditCommandColumn1">
            </EditColumn>
        </EditFormSettings>
    </MasterTableView>
 
        <ClientSettings>
            <Scrolling AllowScroll="True" UseStaticHeaders="True" />
        </ClientSettings>
</telerik:RadGrid>

1 Answer, 1 is accepted

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

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:

Thanks,
Princy.
Tags
Grid
Asked by
cs981khx
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or