Notifications
Announcements
No record found.
Hi all,
Can we hide enum element on dataset.
I want to hide enum element for specific company on EP which is working on dataset.
How can i achieve this.
Thanks and regards
Siddhant Singh
Hi Siddhant Singh,
You can utilize ControlHelper.GetCurrentSessionCompany method in WebControl code and based on company hide certain UI elements on the web page (for example Page_Load method can be the place where to write this logic on WebControl)
using Microsoft.Dynamics.Framework.Portal.CommonControls; ... string company = ControlHelper.GetCurrentSessionCompany(AxBaseWebPart.GetWebpart(this).Session);
Hi Sergei,
Below code is there in Web page, and company is also getting in the code.
Can you please tell what line of code can be written to hide the specific Enum element which is in AX.
protected void Page_Load(object sender, EventArgs e) { string comp = Microsoft.Dynamics.Framework.Portal.SessionHelper.Instance.GetSession().SessionInfo.Company; // Sets the form mode based on the managed content enum parameter this.SetupMode(); bool hoursVisibility = (bool)this.dsAbsenceRequestEdit.GetDataSet().DataSetRun.AxaptaObjectAdapter.Call("hoursVisibility"); this.grpDescription.Fields[2].Visible = hoursVisibility; this.dsAbsenceRequestEdit.GetDataSet().DataSetRun.AxaptaObjectAdapter.Call("checkLeaveBalance"); if(comp != "UK") { HyperLink1.Visible = false; } }
Hi Siddhant,
Could you, please, clarify do you want to hide element based on enum or you want to hide value in enum?
Hi Sirgei,
I want to hide value of Enum, based on company check.
I guess in this case you can create method on DataSet which will return list (or array) of avaiable enum values and you will populate custom combobox control with these value.
The Enum is attached with the AxDropDownBoundField.
Enum has 3 values, Full, half and short.
I have to hide short from this enum.
Can you please tell what may be the code to do so.
Thanks and reagards
As I mentioned before you could try to use the unbound drop-down control (asp:DropDownList) and fill it dynamically with needed elements. The list of elements can be returned from DataSet via method call.
DropDownList1.Items.Add(...
Another option you can try is to create new enum (without short value) and add a new field to the backend table with SaveContent = false and use new enum as type.
On PostLoad you can fill value to the new field from original field and use it in EP in AxDropDownBoundField. On insert\update you can copy value back from new field to original.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
André Arnaud de Cal... 449 Super User 2025 Season 2
Martin Dráb 422 Most Valuable Professional
BillurSamdancioglu 239 Most Valuable Professional