C# .NET - 'FlexGrid1.Rows[FlexGrid1.RowSel].UserData' returns null value.

Asked By bindu shaji on 20-Jun-12 02:28 AM
FlexGrid1.Rows[FlexGrid1.RowSel].UserData' returns null value.
Is there any property of the FlexGrid to changed to get the selection.?
[)ia6l0 iii replied to bindu shaji on 20-Jun-12 01:07 PM
Use the GetData method.

int selectedRowIndex = FlexGrid1.RowSel;
FlexGrid1.GetData(selectedRowIndex , cellIndex);

Thank you.
Vikram Singh Saini replied to bindu shaji on 21-Jun-12 03:54 PM
Try the code below:

string valueByColumn = FlexGrid1.Rows[FlexGrid1.RowSel]["ColumnName"].ToString();

string valueByIndex = FlexGrid1.Rows[FlexGrid1.RowSel][3].ToString();


Note: For passing column index in second code line, it should start with 1 (not from zero). Because the flex grid has been implemented internally in this way. If you pass zero as column index, it will throw exception as Object reference not set to instance of an object.

Hope this helps!