Id
|
bgcolor
|
user
|
cardID
|
1
|
CC6699
|
Myemail@mail.com
|
0023
|
If I selected a div background color using ColorPickerExtender, and the color code I selected is displayed in a textbox. Can I save the selected div background color in a database table as shown in the table above and then retrieve it as the background color of a div on another page?
Is it going to be like this?
string color=dr["bgcolor"].ToString();//my color string
cardDiv.Style.Add("background-color", color);
I’m a bit cinfused because I know that color codes comes after a HashTag(#)
Example: #CC6699.
If I use this,
cardDiv.Style.Add("background-color", color);
It will may just show me CC6699 instead of the selected background color.
Please how do I do this?
This is my HTML
<div runat="server" ID="bgCard">
Test Panel
</div>
<div class="input-group" style="font-size: 4pt;">
<asp:TextBox ID="TextBox1" runat="server" AutoCompleteType="None" Font-Size="4pt" CssClass="form-control" />
<cc1:ColorPickerExtender ID="ColorPicker1" runat="server" TargetControlID="TextBox1"
PopupButtonID="ColorBtn" PopupPosition="TopRight" OnClientColorSelectionChanged="LabelColor" />
<div class="input-group-append">
<span class="input-group-text" id="ColorBtn" runat="server" style="height: auto; background-color: transparent; color: #404344;">
<span id="toggle_picker" class="fad fa-eye-dropper" aria-hidden="true" style="cursor: pointer; font-size: 10pt; border: none;"></span></span>
</div>
</div>
<script type="text/javascript">
function LabelColor(sender) {
document.getElementById("bgCard").style.backgroundColor = "#" + sender.get_selectedColor();
}
</script>