Manish Gautam
Manish Gautam

Reputation: 516

How to hide controls In Ext.net with javascript or in direct events

The problem is simple, I have ids of the contols and i want to show/ hide them on some event.

Actually the problem is i have a direct event on dropdown change i have to hide some controls based on some cases

the code for the direct event is foreach (Control oControl in ProductConfiguration.Controls) { string strName = oControl.GetType().Name; oControl.Visible = false; DataRow[] drIRows = dtInfo.Select("ControlId='" + oControl.ID + "' AND ProductGroupId='" + CboProductGroup.Value + "'");

        if (drIRows.Length > 0)
            oControl.Visible = true;
    }

but the visible property doesnt works with direct events, so my idea was to use javascript instead, can anyone help.

Upvotes: 1

Views: 1637

Answers (2)

James Pusateri
James Pusateri

Reputation: 166

After rendering to the page, visibility cannot be modified since the "visible" property refers to whether or not the client even receives the object to be able to place it on the screen.

I suggest two things if you would like to dynamically change this.

  1. use Hidden="true" rather than Visible = "false" on the page
  2. change your code behind to affect the Hidden property: oControl.Hidden=false;

If you use Hidden property, the client still receives the control to render (it simply doesn't display if set to true), and it can then be quite easily changed.

Upvotes: 1

Daniil Veriga
Daniil Veriga

Reputation: 1851

Please use the Hidden property instead.

The difference is explained here.

Also you can use the Show/Hide methods.

Upvotes: 0

Related Questions