This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.
Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.
Before posting questions here you might want to review the developer documentation.
I am working on a custom module, and would like to include the ability to select a color for part of it. I found the color settings module in the main project, and added it to the edit page for the module. So far, so good.
However, when I attempt to read the selected color in my code-behind file, I am unable to do so. From looking at the code for the ColorSetting control, it looks like I should be able to write something like this (where MyColorPicker is the ID of the ColorSetting control on the form):
string color = MyColorPicker.GetValue();
However, this doesn't work, as GetValue cannot even be found when I try to compile the code-behind. Using ToString() allows everything to compile, but doesn't seem to contain the value I want.
So given this, I am stumped as to how to do two things:
1) Read in the selected color from the ColorSetting control, so I can store it in the Module Settings for my module.
2) Once I've stored a selected color in the Module Settings, make that color be initially selected when I go to the edit page for my module.
Many thanks in advance for your help!
You have to first cast it as ISettingControl before you can call GetValue() or SetValue(...)
Hope it helps,
Ah! That did the trick!
However, I'm now seeing another problem. My edit page has the little box you click to bring up the color picker, but when you click on it, the box it brings up is empty, rather than containing controls to pick a color. I can enter hex values manually, and these are read fine, and this will cause the box to change to the color I enter, but nothing ever appears in the popup box.
If your page does not inherit from mojoBasePage it will not inlcude the needed scripts and css automatically. It works on pages that inherit from mojoBasePage.