Hi Pratheep,
We have achieved your requirement using server side OnClick event of Button control and read the row, column and cell value using DataSource and Column property of the Grid control on server side. Please refer to the following code example.
[aspx] <ej:Button ID="ButtonNormal" runat="server" Size="Large" OnClick="ClearButton_Click" ShowRoundedCorner="true" Text="Button"></ej:Button>
[aspx.cs] protected void ClearButton_Click(object Sender, Syncfusion.JavaScript.Web.ButtonEventArgs e) { var gridModel = this.OrdersGrid; foreach (EditableOrder gridData in (dynamic)gridModel.DataSource) { foreach (Syncfusion.JavaScript.Models.Column gridCol in (dynamic)gridModel.Columns) { object cellText =gridData.GetType().GetProperty(gridCol.Field).GetValue(gridData, null); string header = gridCol.HeaderText; } } } |
We have created the sample that can be downloaded from the below link:
http://www.syncfusion.com/downloads/support/forum/120788/ze/AspGrid-2024568733
Regards,
Saravanan A.
Hi Pratheep,
In our previous sample, we have used EditableOrder as view-model class for binding datasource to the Grid.
In your sample, we found that you have bound the datasource to the Grid using Orders class but have mentioned EditableOrder inside the button click event which is the cause of the issue. To resolve the issue, replace EditableOrder Class with Orders Class as in the following code example.
protected void ClearButton_Click(object Sender, Syncfusion.JavaScript.Web.ButtonEventArgs e) { . . . //Orders view-model class instead of EditableOrder foreach (Orders gridData in (dynamic)gridModel.DataSource) { . . . } } |
http://www.syncfusion.com/downloads/support/forum/120788/ze/F120788877347764
Regards,
Saravanan A.
Hi Pratheep,
Thanks for your update.
We are happy to hear that your issue has been resolved.
Please get back us if you need any further assistance. We will happy to assist you.
Regards,
Saravanan A.