View previous topic :: View next topic |
Author |
Message |
medbiller
Joined: 20 Dec 2007 Posts: 39 Location: Arroyo, PR
|
Posted: Tue Aug 28, 2012 1:13 pm Post subject: vTree show error cell |
|
|
I have a vTree with 1 From Date column & 1 To Date column. Before commiting to database I check that FromDate <= ToDate for each row. Is there a way to mark a cell that has an error (i.e. FromDate > ToDate) like the MS DataViewGrid SetError method? _________________ Medical billing & records developer. |
|
Back to top |
|
|
medbiller
Joined: 20 Dec 2007 Posts: 39 Location: Arroyo, PR
|
Posted: Tue Aug 28, 2012 3:16 pm Post subject: |
|
|
For example when I click the save button I do this:
If vt.FindRow(dtrw).Item(procDx.Name).ToString.Trim.Length = 0 Then
Dim cellData As New CellData(procDx)
binding.GetCellData(vt.FindRow(dtrw), procDx, cellData) 'get the default binding for the given row and use it to populate the cell data
cellData.Error = "Dx pointer Error"
vt.UpdateRowData(vt.FindRow(dtrw))
cellErr = True
End If
Where dtrw if the current datarow I'm checking in a For/Next loop, vt is the vTree. After vtUpdateRowData I see no red dot in the errored cell. _________________ Medical billing & records developer. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Wed Aug 29, 2012 12:05 am Post subject: |
|
|
Yes you can associate errors either with a particular cell or the whole row. If you binding to DataSet then you can just call DataRow.SetColumnError to set the error that should be displayed for a particular column, or set the DataRow.RowError property to set an error in the row header. This will display an error icon in the column or row header and when the user hovers over the error icon the error is displayed in a tooltip. The sample Data Set Browser project demonstrates doing this if you enter a Required Date for an order to be more than 1 month later than todays date it will set an error on the Required Date cell.
If you are not binding to a DataSet then you can still display errors but you need to handle them programmatically. To do this handle the GetCellData event and set the error programmatically eg
Code: | private void _virtualTree_GetCellData(object sender, Infralution.Controls.VirtualTree.GetCellDataEventArgs e)
{
// get the default binding for the given row and use it to populate the cell data
//
RowBinding binding = _virtualTree.GetRowBinding(e.Row);
binding.GetCellData(e.Row, e.Column, e.CellData);
if (someCondition)
{
e.CellData.Error = "There was an error";
}
} |
Then in your Save method you would just call UpdateRowData to force Virtual Tree to update the cell data. _________________ Infralution Support |
|
Back to top |
|
|
|