Disabled button if the user input textbox is empty value

Hi,

May I know how do I configure the disabled expression if I want to disabled the button if the user input textbox is empty value.

Hi,

Does anyone know how to achieve this?

Use a page property which is set to the Value of the TextBox. Then set the Disabled property to ${textBoxValue.length == 0}.

Hi @korchev,

That work for me. Thank you.

Just wondering how could I make multiple conditions in DISABLE property.

I try to set it as

  1. ${textbox1.length == 0} OR ${textbox2.length ==0}
  2. ${textbox1.length ==0} || ${textbox2.length ==0}

but both way hit the error.

Change to

${textbox1.length ==0 || textbox2.length ==0}

What is textbox1? If it is the TextBox itself it won't work - you need a string page property.

Hi @Vinod_Pillai,

Thanks and it works for me.

@korchev,

It just a textbox with string type, and this ${textbox1.length ==0 || textbox2.length ==0} works for me.
thanks

Is this still a valid solution? I am trying this in my Blazor app and it doesn't like the syntax. $ unrecognized character.

This thread is for Angular and the solution applies only to Radzen Angular applications.

Sorry, just noticed this is in the Angular section. Is there a way to do this in Blazor?

Ah, I have found my answer: Disabled="@(string.IsNullOrWhiteSpace(SelectedUserName))"

Thanks anyway.

1 Like