Hello,
I want to ask if there is anything like “Conditional Formatting” for the controls of the DataRepeateritems. For example, when the value of a certain textbox is above a certain value , the background color for this textbox should be red.
Thanks,
Peter
Hi Peter,
You’ll want to reset the TextBox to the default color when the condition is not satisfied.
Items inside the DataRepeater are cloned, meaning when you change the color once, and it gets reused, you’ll see that change reflected on multiple textboxes as well.
This code should fix it!
Dim lbl = e.DataRepeaterItem.Controls.Find(“txtAmount”, True).FirstOrDefault()
If lbl IsNot Nothing AndAlso Not String.IsNullOrEmpty(lbl.Text) Then
Dim value As Integer
If Integer.TryParse(lbl.Text, value) Then
If value < 10 Then
lbl.BackColor = Color.Orange
Else
lbl.BackColor = Color.White
End If
End If
End If
Best Regards,
Alaa
Hi Peter,
thanks for the sample. I could open it and see what you described.
We’ll check it and get back to you.
Best regards
Frank
Hi Frank,
I assume you cannot open the solution in the previous message.
I could not, so attached the one I also could open and is within the max update size.
Please let me know if you can open the solution.
BR
Peter
Hi Frank,
Attached the testexample.
I am using version 3.5.11
BR
Peter
Hi Peter,
I still cannot reproduce the behavior that you are describing.
Can you please attach a complete runnable test case instead of code snippets in screenshots?
Please also let us know which Wisej.NET version you are using.
Thanks in advance.
Best regards
Frank
Hi Frank,
Again sorry for the wrong code attached.
Herewith the correct code.
BR,
Peter
Hi Frank,
Sorry for the wrong results I sent before.
I have attached new code and rsults.
I have used a DataRepeater and a Datagrid to compare and show the differences.
It looks like the itemUpdate on the Datarepeater is causing issues when scrolling.
The difference beteween both views is that the formatting a the Datagrid is performed after CompletedBinding and the datarepeater after ItemUpdate.
BR,
Peter
Hi Frank,
I am programming in VB.
Code for DataRepeater.ItemUpdate and result: Only first 10 records (repeater items) are OK. Next records NOK.
See attachments.
BR,
Peter
Hi Peter,
you can use the ItemUpdate event to handle any formatting.
Please find a very simple test case attached.
Best regards
Frank
Please login first to submit.