Hi
I have a repeater. I want if value of a particular column say 10 is 1 , i want to highlight column 2 of that row
Thanks
Hi
I have a repeater. I want if value of a particular column say 10 is 1 , i want to highlight column 2 of that row
Thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Aravind GovindarajPosted May 31, 2023, 7:58 PM
Please find the code snippet for the same
Prasad RaveendranPosted May 31, 2023, 6:59 PM
To highlight a column in a repeater control based on its value, you can use a conditional statement in the markup or code-behind of the repeater control. Here's an example using ASP.NET Web Forms:
Define your repeater control in the markup:
In the code-behind, define the HighlightColumn method to conditionally set the CSS class for the column based on its value:
Define the CSS class in your stylesheet:
In this example, the HighlightColumn method checks the value of the column and returns a CSS class attribute that includes the class name "highlighted-column" if the condition is met. The CSS class defines the styles for highlighting the column, such as setting the background color to yellow. Adjust the condition and CSS styles according to your specific requirements.
Remember to bind your repeater control to the data source and call the appropriate method to populate the repeater before rendering the page.