V
V
Vyacheslav Shabunin2021-01-18 20:38:08
ASP.NET
Vyacheslav Shabunin, 2021-01-18 20:38:08

I'm making a wheel of fortune. How to change block class directly from C#?

I'm making a wheel of fortune. I registered for each variation of the wheel stop my own animation in css (@keyframes).

I think you understand how the wheel of fortune looks and works, and each division has its own animation, for example, one keyframe for a banana, and for strawberries, for example, another animation.
In the C# class, I made a randomizer that returns the names of css class names, with animations. And if the name of the css class for a banana drops out, then the animation for it will be played, the same with strawberries.
After pressing the rotate button, the css class that was selected by the c # code should be substituted into the block.

For mvs, I could use html helpers and already substitute the required class in the div block.
But how to change block classes in WF through a script?

Why didn't you use MVC right away? I can not answer - so it is necessary.
- I did not find the answer in Google with WF.
-I will not use ready-made scripts.
Why did you choose this implementation? - Apparently I'm stupid and could not think of anything better.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vyacheslav Shabunin, 2021-01-22
@fleshherbal

Found a solution to this issue. It turned out to be very simple. To change the css class from c# code, just use the CssClass property
https://docs.microsoft.com/en-us/dotnet/api/system...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question