Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

Conditional Blazor Styles

<input style="@StyleForNumber(MyNumber)" type="number" @bind=MyNumber @bind:event="oninput" />

@code{
	private string StyleForNumber(int n)
	{
  		if (n > 100) return "";
   		if (n < 1)  return "color:red";
   		return "background:lightgreen";
	}
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: how to convert int to char in c# 
Csharp :: readonly vs const c# 
Csharp :: regex c# password numbers and letters 
Csharp :: c# get pixel color from image 
Csharp :: c# solution path 
Csharp :: DateTime previous day c# 
Csharp :: c# retrieve files in folder 
Csharp :: how to stop rigidbody2d from falling in unity 
Csharp :: loop through all enum values in C# 
Csharp :: c# encrypt decrypt string 
Csharp :: C# convert iformfile to stream 
Csharp :: c# how to use inovke 
Csharp :: c# iterate over a dictionary 
Csharp :: programmatically write bash script from c# 
Csharp :: c# how to terminate console application 
Csharp :: unity clamp rotation 
Csharp :: c# list index 
Csharp :: generate random name c# 
Csharp :: jarray to list c# 
Csharp :: unity position localposition 
Csharp :: how to find a gameobject in unity 
Csharp :: c# create a zip files 
Csharp :: c# cast to type variable 
Csharp :: selenium open chrome c# 
Csharp :: reverse a string in c# 
Csharp :: how to print hello world in c# 
Csharp :: randomm number from 2 different ranges 
Csharp :: c# string to byte[] 
Csharp :: newtonsoft create dynamic object 
Csharp :: c# console wait for input 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =