Am trying to get a cell value from gridview in repositoryItemGridLookUpEdit1_EditValueChanged event. But am getting null value only then error show like this "Object reference not set to an instance of an object" in that line.
How to get cell value in particular row from gridview in EditValueChanged Event ?
my code is this
private void repositoryItemGridLookUpEdit1_EditValueChanged(object sender, EventArgs e)
{
GridLookUpEdit LookupEdit = sender as GridLookUpEdit;
DataRowView SelectedDataRow = (DataRowView)LookupEdit.GetSelectedDataRow();
gridView1.SetFocusedRowCellValue("Description", SelectedDataRow["ProductDescription"]);
gridView1.SetFocusedRowCellValue("UoM", SelectedDataRow["UnitofMeasure"]);
gridView1.SetFocusedRowCellValue("Quantity", SelectedDataRow["DefaultQuantity"]);
gridView1.SetFocusedRowCellValue("Price", SelectedDataRow["MRPPrice"]);
gridView1.SetFocusedRowCellValue("TaxInPercentage", SelectedDataRow["Taxid1"]);
gridView1.SetFocusedRowCellValue("ProductKind", SelectedDataRow["ProductKind"]);
getdisc = LookupEdit.EditValue.ToString(); // get display value & pass to comparision to find Discound
object productkin = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns["ProductDescrption"]);
string productkind = productkin.ToString(); // Error Object reference not set to instance of object
MessageBox.Show(productkind, "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
Help me ?
ProductDescriptionversusProductDescrption(note the missingiin the second one).