vcsharp
  •  vcsharp
  • 88.4% (Honored)
  • YAF Commander Topic Starter
2017-11-19T10:23:24Z
I am finding that dropdowns in YAF have a select element rendered with a display="none" and some other element shows as UI for these dropdowns. May be I need to disable some jquery plugin.

How can I restore the select element for all dropdowns, so its display is not set to none?

An example is the country dropdown in controls/editUserProfile.ascx.
Sponsor
tha_watcha
2017-11-19T10:33:53Z
Originally Posted by: vcsharp 

I am finding that dropdowns in YAF have a select element rendered with a display="none" and some other element shows as UI for these dropdowns. May be I need to disable some jquery plugin.

How can I restore the select element for all dropdowns, so its display is not set to none?

An example is the country dropdown in controls/editUserProfile.ascx.



you could remove the css class from these drop downs ore remove the js code that converts the drop downs


   jQuery(".standardSelectMenu").selectmenu({
        change: function() {
            if (typeof (jQuery(this).attr('onchange')) !== 'undefined') {
                __doPostBack(jQuery(this).attr('name'), '');
            }
        }
    });

    jQuery(".standardSelect2Menu").select2({
        width: '350px'
    });


the code need to be remove from the ../Scripts/yaf.js


PS: why do you want to use the regular drop downs? For example the country dropdown shows the Country flag next to the country name.
UserPostedImage
vcsharp
  •  vcsharp
  • 88.4% (Honored)
  • YAF Commander Topic Starter
2017-11-19T15:07:53Z
I have Telerik website that uses FormDecorator to style various html elements. Right, now select element style is being overridden by jquery logic for drop downs. I would prefer the Tekerik theme for select elements to keep appearance consistent.

Is jquery-ui script also being loaded somewhere?
vcsharp
  •  vcsharp
  • 88.4% (Honored)
  • YAF Commander Topic Starter
2017-11-19T17:45:38Z
Originally Posted by: tha_watcha 

Originally Posted by: vcsharp 

I am finding that dropdowns in YAF have a select element rendered with a display="none" and some other element shows as UI for these dropdowns. May be I need to disable some jquery plugin.

How can I restore the select element for all dropdowns, so its display is not set to none?

An example is the country dropdown in controls/editUserProfile.ascx.



you could remove the css class from these drop downs ore remove the js code that converts the drop downs


   jQuery(".standardSelectMenu").selectmenu({
        change: function() {
            if (typeof (jQuery(this).attr('onchange')) !== 'undefined') {
                __doPostBack(jQuery(this).attr('name'), '');
            }
        }
    });

    jQuery(".standardSelect2Menu").select2({
        width: '350px'
    });


the code need to be remove from the ../Scripts/yaf.js


PS: why do you want to use the regular drop downs? For example the country dropdown shows the Country flag next to the country name.



I went to the file jquery.ForumExtensions.min.js and deleted the following code. This does remove all special styled select elements except the Country drop down on EditUserProfile page. Any idea why Country drop down is not changing to normal select?


jQuery(".standardSelectMenu").selectmenu({change:function(){typeof jQuery(this).attr("onchange")!="undefined"&&__doPostBack(jQuery(this).attr("name"),"")}});jQuery(".standardSelect2Menu").select2({width:"350px"});
tha_watcha
2017-11-19T18:04:58Z
Because its not a regular dropdown its a custom imagelistbox. Try to modify the ..controls\EditUserControl.ascx and remove the CssClass from the control

<YAF:ImageListBox ID="Country" AutoPostBack="true" OnTextChanged="LookForNewRegions" runat="server" CssClass="selectMenuWithIcons" />

UserPostedImage
vcsharp
  •  vcsharp
  • 88.4% (Honored)
  • YAF Commander Topic Starter
2017-11-19T18:17:49Z
I removed the css class, so now the country dropdown looks like following. Still it does not look like default select element. May be there is something in the custom control of ImageList that is causing this.


<YAF:ImageListBox ID="Country" AutoPostBack="true" OnTextChanged="LookForNewRegions" runat="server"  />


I think the following server-side code in EditUserProfile.ascx.cs is causing some JavaScript to be emitted that could be the reason for Country drop down not becoming a regular select.


   /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.PreRender" /> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs" /> object that contains the event data.</param>
        protected override void OnPreRender([NotNull] EventArgs e)
        {
            // setup jQuery and DatePicker JS...
            if (this.GetText("COMMON", "CAL_JQ_CULTURE").IsSet())
            {
                this.PageContext.PageElements.RegisterJQueryUILanguageFile(this.CurrentCultureInfo);
            }

            this.PageContext.PageElements.RegisterJsBlockStartup(
                "DatePickerJs",
                JavaScriptBlocks.DatePickerLoadJs(
                    this.Birthday.ClientID,
                    this.GetText("COMMON", "CAL_JQ_CULTURE_DFORMAT"),
                    this.GetText("COMMON", "CAL_JQ_CULTURE")));

            this.PageContext.PageElements.RegisterJsBlockStartup(
                "dropDownJs",
                JavaScriptBlocks.SelectMenuWithIconsJs(this.Country.ClientID));

            base.OnPreRender(e);
        }
vcsharp
  •  vcsharp
  • 88.4% (Honored)
  • YAF Commander Topic Starter
2017-11-19T19:00:28Z
I had to make 2 changes in code-behind of EditUserProfile.cs to revert Country drop down to a simple select element.

  • Comment the line of code in Page_PreRender as below.


this.PageContext.PageElements.RegisterJsBlockStartup(
              "dropDownJs",
                JavaScriptBlocks.SelectMenuWithIconsJs(this.Country.ClientID));


  • Comment the line of code in BindData method as below, so no images are visible.


this.Country.ImageLocation = YafForumInfo.GetURLToContent("images/flags/{0}.png");

About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button

Project Twitter Updates

Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved