Hi
In below code i want if Status = "Disabled" then Delete shoud be greyed
htmlTable.Append(" ");
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.
Gowtham CpPosted Aug 23, 2024, 5:23 AM
To gray out the "Delete" button when the status is "Disabled," you can adjust your code like this:
This makes your UI cleaner and more intuitive! Hope it helps!
Aman GuptaPosted Aug 24, 2024, 9:20 AM
Hi Ramco,
To conditionally grey out the delete icon based on the
Statusvalue in your HTML, you need to dynamically modify the HTML string based on theStatusvalue. Here's how you can achieve this in C#.C# Code Example
Explanation:-
- The
-
- If
- Uses the class
- Includes
- Uses
-
- If the status is not "Disabled", the delete icon retains its normal appearance and functionality.
CSS Classes:Check Status:
ifstatement checks if thestatusis "Disabled".Greying Out the Delete Icon:
statusis "Disabled", the delete icontag:text-secondary-600to apply a grey color.style='pointer-events: none;'to make it non-clickable.onclick='return false;'to prevent any actions if clicked.Default Case:
Ensure you have the necessary CSS classes defined to reflect the grey color for disabled state. For example:
Usage:This code dynamically generates HTML based on the
statusvalue, allowing you to conditionally format the delete icon in your table rows.