Hi, I want to use if condition in .ascx file. As shown below:
<%= if (value.equals("xyz")) {} %>
as shown above, if i use like that. then i am getting error of "invalid expression if".
please guide me.
Hi, I want to use if condition in .ascx file. As shown below:
<%= if (value.equals("xyz")) {} %>
as shown above, if i use like that. then i am getting error of "invalid expression if".
please guide me.
Above answers can not be used for boolean atributes such as "Visible". Instead put this code in the BindData() function.
if (condition) {
this.pnlMyPanel.Visible = true;
} else {
this.pnlMyPanel.Visible = false;
}
If you don't tipically use BindData(), put it in Page_Load under
if (!this.IsPostBack) {}
block.