Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
146978 | Aug 27,2019 01:09 PM UTC | Aug 29,2019 10:09 AM UTC | WinForms | 3 |
![]() |
Tags: SfDataGrid |
private void button1_Click(object sender, EventArgs e)
{
if (sfDataGrid.SelectedItem != null)
{
var orderInfo = (sfDataGrid.SelectedItem as OrderInfo);
if (!string.IsNullOrEmpty(orderInfo.Country) &&
!string.IsNullOrEmpty(orderInfo.CustomerID) &&
!string.IsNullOrEmpty(orderInfo.CustomerName))
{
// You can save the edit value here.
}
}
} |
sfDataGrid.RowValidating += SfDataGrid_RowValidating;
private void SfDataGrid_RowValidating(object sender, Syncfusion.WinForms.DataGrid.Events.RowValidatingEventArgs e)
{
if (sfDataGrid.IsAddNewRowIndex(e.DataRow.RowIndex))
{
var data = (e.DataRow.RowData as DataRowView).Row;
if (string.IsNullOrEmpty(data.ItemArray[0].ToString()) || string.IsNullOrEmpty(data.ItemArray[1].ToString()) || string.IsNullOrEmpty(data.ItemArray[2].ToString()))
{
e.ErrorMessage = "Records cannot be empty";
e.IsValid = false;
}
}
} |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.