The official release of Ext.NET Mobile is now available. Ext.NET Mobile is an ASP.NET component framework for building Phone and Tablet specific mobile web applications. Read More

Set Hide property of Ext control in Javascript with MVC version.

  1. #1

    Set Hide property of Ext control in Javascript with MVC version.

    Hello,
    In Ext 2.5 version we are using hide() property in javascript to hide an Ext control. But after migration with 4.5.1 same code not working in javascript level.

    E.g. code written at .cshtml
    X.ComboBox()
                .ID("CmbData")
                .AllowBlank(false)
                .Editable(true)
                .ForceSelection(true)
                .QueryMode(DataLoadMode.Local)
                .TriggerAction(TriggerAction.All)
                .EmptyText("-- Select Status --")
                .Items(new ListItem("Active", true),
                new ListItem("Inactive", false))
                );
    Combobox accessed in javascript as below:
      if (Somecondtion==true)
            App.CmbData.show();
        else {
            App.CmbData.hide();
             }
    Note: Server side we are able to hide the control by using Hidden property.
    Last edited by MOHAMMEDRAFI; Jul 03, 2018 at 12:08 PM.
  2. #2
    Hello @MOHAMMEDRAFI!

    Interesting, this is still the way you should be doing to hide not just combo boxes, but any components in Ext.NET! Client-side speaking, this is also true, according to documentation on combo box's hide() method.

    In fact, the method works if I try it in the combo boxes within the Linked Combo Boxes example in MVC Examples Explorer.

    I can think on some possibilities it is not working for you in your scenario:

    - The context you are using it is not compatible with the hideMode setting you chose, or the default one. So try changing it to the other alternatives and see if they work.
    - You are calling hide() too early during the page load, before the component is actually rendered, so it just does nothing and, when drawn it still has its hidden setting set as false and so it is displayed; if this is the case you can do something like:

    if (App.CmbData.rendered) {
     App.CmbData.hide();
    } else {
     App.CmbData.hidden = true;
    }
    Based on what you provided, that's what I can think of, I hope this helps!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 3
    Last Post: Feb 08, 2017, 4:31 PM
  2. Replies: 6
    Last Post: Jul 28, 2011, 4:43 PM
  3. [CLOSED] how to set panel html property as javascript property
    By kenanhancer in forum 1.x Premium Help
    Replies: 10
    Last Post: Jan 05, 2011, 6:45 PM
  4. [CLOSED] FormPanel - Hide control - label control
    By seanwo in forum 1.x Premium Help
    Replies: 4
    Last Post: Aug 11, 2010, 8:57 AM
  5. [ADDED] [V0.6] Hide Property
    By Timothy in forum Feature Requests
    Replies: 6
    Last Post: Sep 01, 2008, 7:15 PM

Posting Permissions