jeudi 5 octobre 2017

Can you place an if statement in .ascx layout?

I'm new with working with ASP.net and .ascx, and now I've seen a button that calls a method by 'OnClientClick' So the code looks like this:

<asp:Button Text="Save" OnClick="BtnSave_Click" OnClientClick="isBusy();"/>

Now I want that the method only calls at certain definitions declared in the same .ascx file. And thus I thought that an if-statement inside the ascx would work. So I've already tried attempts like OnClientClick="if(Text.Length <= maxlength) { isBusy(); } but that caused the line to not respond at all.

Currently I'm wondering if an if-statement in this situation is actually possible.

Aucun commentaire:

Enregistrer un commentaire