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

Lose changed values on clicking asp button

1 Answer 13 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Мирзодалер
Top achievements
Rank 1
Мирзодалер asked on 21 Oct 2016, 05:36 AM

Hello,
I am using a RadGrid with multiple columns which can be edited (BatchEdit like excel).

<telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" runat="server" AutoGenerateColumns="False"GridLines="Both"OnNeedDataSource="RadGrid1_NeedDataSource" AllowAutomaticInserts="True" AllowAutomaticUpdates="True"AllowAutomaticDeletes="True">
            <ItemStyle Wrap="false" />
            <MasterTableView TableLayout="Fixed" NoMasterRecordsText="" ShowFooter="true" EditMode="Batch">
                ...
            </MasterTableView>
</telerik:RadGrid>


Datasource of RadGrid is ObjectDataSource

<asp:ObjectDataSource ID="TestSource" runat="server" TypeName="TestClass" SelectMethod="GetAllItems">
      <UpdateParameters>
                <asp:Parameter Name="Name" Type="String" />
                <asp:Parameter Name="LastName" Type="String" />
                <asp:Parameter Name="BirthData" Type="DateTime" />
      </UpdateParameters>
</asp:ObjectDataSource>


On OnNeedDataSource event I'm setting Id of ObjectDataSource to RadGrid.DataSourceId.

protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
        RadGrid1.DataSourceID = "TestSource";
}


In current Page I have also button "Send email" send rad gird inserted values.
<asp:Button ID="SendEmail" OnClick="SendEmail_Click" Text="Send" runat="server" />

Problem is that on SendEmail_Click DataSource is null. But I want to get newly changed DataSource.

protected void SendEmail_Click(object sender, EventArgs e)
{
        RadGrid1.Rebind();
        // RadGrid1.Datasource is null
}

 

How I can solve this problem?

 

Thanks,

Daler

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 25 Oct 2016, 11:13 PM
Hi,

Note that the changes made on client-side with Batch Editing are not available on server-side, except when the "Save Changes" button is clicked or when the BatchEditingManager is used for manually initiate saving.

For more information about Batch Editing functionality of the grid you can refer to the article below:
http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/data-editing/edit-mode/batch-editing/overview

Regards,
Pavlina
Telerik by Progress
Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
Tags
Grid
Asked by
Мирзодалер
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or