Welcome Guest Search | Active Topics | Sign In | Register

ColorPicker set-get value Options
hunpirate
Posted: Friday, May 11, 2012 11:03:10 AM
Rank: Advanced Member
Groups: Member

Joined: 6/14/2007
Posts: 83
Hi,

This is the first time I'm trying to use the colorpicker control. I'm saving its value to a database and reading it back to the control to recover the color.

Code: HTML/ASPX
<eo:ColorPicker ID="cpColor" runat="server" ControlSkinID="None" 
	Value="Black" BLabelText="Blue:" GLabelText="Green:" RLabelText="Red:"
	TitleText="Select booking type color:" CssClass="btnLinkScheduleSample">
	<PopupStyle CssText="border: #711F2F 2px solid; background-color: #F2F2F2;" />
	<TextBoxStyle CssText="border: #711F2F 1px solid;" />
</eo:ColorPicker>


To save the value I use:
Code: Visual Basic.NET
cpColor.Value.ToString

To recover:
Code: Visual Basic.NET
cpColor.Value = System.Drawing.Color.FromName(myreader("BookingColor"))


The problem is that even though I do not get any error during the process the colorpicker control do not change its start up value of "Black" to, let say "Color [A=255, R=181, G=194, B=45]" coming from the database.

What am I doing wrong?


Thanks

Steve Komaromi

Computer Systems Manager, Lead Developer
Business Risk Partners, Inc.
Tel: 1-(860)-903-0039
eo_support
Posted: Friday, May 11, 2012 11:15:27 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Hi,

Your code is right and the color should change. There could be some other code somewhere that set it to black, or the value from your database is indeed black. In any case, the Value property is the property you set/get with the ColorPicker control. You can try to set it to some fixed color such as Color.Red in a separate page to see how it works.

Thanks!
hunpirate
Posted: Friday, May 11, 2012 11:54:46 AM
Rank: Advanced Member
Groups: Member

Joined: 6/14/2007
Posts: 83
Thanks for the quick reply. I tried to use a fixed color and that seem to be working.

Code: Visual Basic.NET
cpColor.Value = FromName(myreader("BookingColor"))
 cpColor.Value = Red


The value coming from the database is "Color [A=255, R=181, G=194, B=45]", but if I make a break on the second line before I assign the "Red" color the cpColor.Value is still "Black". Breaking after the second line and examining the color value, the color changes to "Red". Clearly passing the value of "Color [A=255, R=181, G=194, B=45]" --right or wrong-- does not trigger a color change like it does for the fixed color.

Any thoughts on that?


Thanks

Steve Komaromi

Computer Systems Manager, Lead Developer
Business Risk Partners, Inc.
Tel: 1-(860)-903-0039
eo_support
Posted: Friday, May 11, 2012 12:00:09 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Hi,

I don't think this is a question for us. The control gives you Value property and takes a System.Drawing.Color value. If it takes one System.Drawing.Color value, then it would take another System.Drawing.Color value. If it doesn't work for you, then your Color value is wrong and you need to fix that. It's plain and simple and there is no magic here.

Thanks
hunpirate
Posted: Friday, May 11, 2012 12:45:55 PM
Rank: Advanced Member
Groups: Member

Joined: 6/14/2007
Posts: 83
Hi,

Saving it in ARGP and recovering it as ARGB solved it.

To save:
Code: Visual Basic.NET
cpColor.Value.ToArgb

To recover:
Code: Visual Basic.NET
cpColor.Value = FromArgb(CInt(myreader("BookingColor")))


I did not change any other part of the code.


Thanks

Steve Komaromi

Computer Systems Manager, Lead Developer
Business Risk Partners, Inc.
Tel: 1-(860)-903-0039


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.