Hi,
Is there a way to choose BackgroundColor of cells in RadSpreadsheet from UI that are not part of the given list of colors???
or maybe a way to edit the background color # from UI ???
thanks,
Efrat
Hi,
In RadEditor I need to use radcolorpicker to add custom colors. When we click "Add Custom Color" now its giving a popup and
we need to type the hex color code.
without doing that is there a way to use radcolorpicker after click the "Add Custom Color".
Thank You,
Sahan
Hiya,
I have a grid with a template column that contains a RadColorPicker. I would like to read the color values in a postback. However, using the code below, I'm only getting the values from the original data source.
ASPX:
<telerik:RadGrid ID="grdUser" runat="server" AllowMultiRowSelection="true" AutoGenerateColumns="false" ShowStatusBar="true"
AllowSorting="True" AllowFilteringByColumn="true"
OnItemDataBound="grdUser_ItemDataBound">
<MasterTableView DataKeyNames="UserId, UserName, HexCode" CommandItemDisplay="None">
<Columns>
<telerik:GridClientSelectColumn UniqueName="ClientSelectColumn" HeaderStyle-Width="40px"/>
<telerik:GridBoundColumn UniqueName="UserName" HeaderText="Name" DataField="UserName" />
<telerik:GridTemplateColumn DataField="HexCode" HeaderText="Route Colour" UniqueName="HexCode">
<EditItemTemplate>
<telerik:RadColorPicker ID="editColor" runat="server" SelectedColor='<%# Bind("HexCode") %>' />
</EditItemTemplate>
<ItemTemplate>
<telerik:RadColorPicker id="RadColorPicker1" runat="server" ShowIcon="true" />
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
<ClientSettings>
<Selecting AllowRowSelect="true" />
<Scrolling AllowScroll="True" UseStaticHeaders="True" />
</ClientSettings>
</telerik:RadGrid>
<telerik:RadButton ID="btnGo" runat="server" Text="Go" />
C#:
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
DataTable dataTable = new DataTable();
dataTable.Columns.Add("UserId", typeof(long));
dataTable.Columns.Add("UserName", typeof(string));
dataTable.Columns.Add("HexCode", typeof(string));
dataTable.Rows.Add(1, "Bob", "#2E8B57");
dataTable.Rows.Add(2, "Tim", "#BA55D3");
dataTable.Rows.Add(3, "Jim", "#FF8C00");
dataTable.Rows.Add(4, "Rob", "#4682B4");
dataTable.Rows.Add(5, "Dan", "#B22222");
grdUser.DataSource = dataTable;
grdUser.DataBind();
}
else
{
foreach (Telerik.Web.UI.GridDataItem user in grdUser.SelectedItems)
{
// Read new color values from the grid.
string alteredColor = grdUser.MasterTableView.DataKeyValues[user.ItemIndex]["HexCode"].ToString();
}
}
}
protected void grdUser_ItemDataBound(object sender, GridItemEventArgs e)
{
GridDataItem item = e.Item as GridDataItem;
if (item != null)
{
RadColorPicker rcpDeviceColour = e.Item.FindControl("RadColorPicker1") as RadColorPicker;
if (rcpDeviceColour != null)
{
string hexCode = item.GetDataKeyValue("HexCode").ToString();
rcpDeviceColour.SelectedColor = System.Drawing.ColorTranslator.FromHtml(hexCode);
}
}
}
How do I read the updated color values in the grid during a postback?
Thanks in advance,
Matt
Hello,
I'm trying to localize the RadColorPicker using resource-files placed in the App_GlobalResources of my website, which is working fine for most of the telerik controls (e.g. RadComboBox). In case of the RadColorPicker, adding these resource files doesn't seem change anything. For example the following code does not use any resource-file values for the texts and tooltips of "No color", "Custom color" as well as the "OK" and "cancel" buttons within the "Custom color" sub-control.
<
telerik:RadColorPicker
runat
=
"server"
ID
=
"RadColorPickerStatusColor"
Preset
=
"Standard"
EnableCustomColor
=
"true"
SelectedColor
=
"#FFFFFF"
/>
Because I'm using this control in multiple places, I dislike the way localization for RadColorPicker is beeing described in the docs (Telerik Docs: RadColorPicker). Additionally, I'm not able to find the key for at least the cancel-button within the supplied resource files (en, de, fr; which are available for download at https://www.telerik.com/account/product-download?product=RCAJAX).
As for the screenshot, the current Culture of the website is German, so I would expect the RadColorPicker to be displayed using the RadColorPicker.de-DE.resx file. Obviously these values are English though.
Any tips on the missing key for the cancel-button or the fact, that there's no localization at all?
Kind regards
Issue 1:
I'm trying to add a radcolorpicker to a grid such that when inserting or updating a row, the color picker will display and it's selected value will show in the "Color" column field.
Using a templates i've added it to the edit column, but it doesn't do anything, can't even select colors, and when compiled and ran I get a javascript error: "Sys" is undefined.
I'm sure I have the basic idea of how to use it wrong. Of course. :)
I have a scriptmanager in place, although I'm not going to speculate on what that does. :)
Any ideas on what I'm missing, or doing wrong?
Issue 2:
protected void RadColorPicker1_ColorChanged(object sender, EventArgs e) |
{ |
Label1.Text = ColorTranslator.ToHtml(RadColorPicker1.SelectedColor); |
} |
When compiling this gives me a compile time Error --
"The name 'RadColorPicker1' does not exist in the current context ..."
How do I ensure it's context?
Al
<radG:RadGrid |
ID="RadGrid2" runat="server" |
Height="100px" |
Width="500px" |
Title="Rules" |
BorderStyle="Solid" |
BorderWidth="1px" |
DataSourceID="ObjectDataSource1" |
GridLines="None" |
AllowAutomaticInserts="True" |
AllowAutomaticUpdates="True" |
AutoGenerateColumns="False" |
MasterTableView-AllowPaging="true" |
OnDeleteCommand="RadGrid2_DeleteCommand" |
OnPreRender="RadGrid2_PreRender" |
OnItemEvent="RadGrid2_ItemEvent" |
OnItemInserted="RadGrid2_ItemInserted" |
OnItemUpdated="RadGrid2_ItemUpdated" |
OnCancelCommand="RadGrid2_CancelCommand" |
OnDataBound="RadGrid2_DataBound" > |
<MasterTableView |
DataKeyNames="idExceptionRule" |
DataSourceID="ObjectDataSource1" |
AllowPaging="True" > |
<ExpandCollapseColumn Visible="False"> |
<HeaderStyle Width="19px" /> |
</ExpandCollapseColumn> |
<RowIndicatorColumn Visible="False"> |
<HeaderStyle Width="20px" /> |
</RowIndicatorColumn> |
<Columns> |
<radG:GridBoundColumn DataField="decMin" HeaderText="From" UniqueName="From"> |
</radG:GridBoundColumn> |
<radG:GridBoundColumn DataField="decMax" HeaderText="To" UniqueName="To"> |
</radG:GridBoundColumn> |
<radG:GridBoundColumn DataField="hexColourFont" HeaderText="Color" UniqueName="Color"> |
<ItemStyle BackColor="White" BorderColor="#404040" BorderStyle="Solid" BorderWidth="1px" |
HorizontalAlign="Left" VerticalAlign="Middle" /> |
</radG:GridBoundColumn> |
<radG:GridTemplateColumn DataField="hexColourFont" ShowSortIcon="False" UniqueName="TemplateColumn"> |
<EditItemTemplate> |
<telerik:RadColorPicker ID="RadColorPicker1" runat="server" Preset="Web216" |
ShowIcon="True" OnDataBinding="RadColorPicker1_ColorChanged" AutoPostBack="True" OnColorChanged="RadColorPicker1_ColorChanged"> |
</telerik:RadColorPicker> |
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> |
</EditItemTemplate> |
</radG:GridTemplateColumn> |
<radG:GridEditCommandColumn> |
</radG:GridEditCommandColumn> |
<radg:GridButtonColumn CommandName="Delete" Text="Delete" |
UniqueName= "DeleteColumn" ButtonType="ImageButton" ImageUrl=".\delete.gif" /> |
</Columns> |
<EditFormSettings> |
<EditColumn UniqueName="EditCommandColumn1"> |
</EditColumn> |
</EditFormSettings> |
</MasterTableView> |
<ValidationSettings CommandsToValidate="PerformInsert,Update,Delete" /> |
</radG:RadGrid> |
When the color picker is on a tab that is not active when the page loads the cursor (crosshair) is not in the right location. The color is correct, the cursor is not. I tried a few things I saw in this forum, repainting clientside when the tab becomes active, and adding this script to the bottom of the page. But no luck. Any Ideas? Thank you. Telerik version = 2017.3.913.45
function OnClientActiveTabChanged()
{
$find("<%=colorBackGround.ClientID %>").repaint();
}
Telerik.Web.UI.RadColorPicker.prototype._updateHslSliderBackground = function (hsl, isCustomColor)
{
var color = this._hslToRgb(hsl.h, hsl.s, 0.5);
var slider = isCustomColor ? this.get_millionCustomColorsSlider() : this.get_millionColorsSlider();
if (slider._trackElement)
{
slider._trackElement.style.backgroundColor = this._rgbValuesToHex(color.r, color.g, color.b);
}
}
I want to set the color of color picker when the Page Load. But it always cannot find the rad color picker control. It always get null.
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(IsPostBack ==
false
)
{
string
szJS =
"OptionSettingsLoad();"
;
RadScriptManager.RegisterStartupScript(
this
,
this
.GetType(),
"OptionSettingsLoad"
, szJS,
true
);
}
}
The javascript has add the global function for initialize the TelerikDemo object and its function for color change.
I cannot find the color picker control by
var colorPickerDischargeTitleColor = $find("RadColorPickerDischargeTitleColor");
the color Picker"colorPickerDischargeTitleColor " always be null.
function
(global, undefined) {
var
TelerikDemo = global.TelerikDemo = {};
function
OnClientColorChangeDischargeTitleColor(sender, eventArgs) {
var
colorPicker = $find(
"RadColorPickerDischargeTitleColor"
);
var
strColor = sender.get_selectedColor();
}
TelerikDemo.OnClientColorChangeDischargeTitleColor = OnClientColorChangeDischargeTitleColor;
function
OnClientColorChangeDischargeContentColor(sender, eventArgs) {
//alert("Selected color is changed from " + eventArgs.get_oldColor() + " to " + sender.get_selectedColor() + ".");
var
colorPicker = $find(
"RadColorPickerDischargeContentColor"
);
var
strColor = sender.get_selectedColor();
}
TelerikDemo.OnClientColorChangeDischargeContentColor = OnClientColorChangeDischargeContentColor;
})(window);
function
OptionSettingsLoad()
{
var
LS_titleColor = localStorage.getItem(DISCHARGE_TITLE_COLOR);
var
LS_contentColor = localStorage.getItem(DISCHARGE_CONTENT_COLOR);
var
colorPickerDischargeTitleColor = $find(
"RadColorPickerDischargeTitleColor"
);
var
colorPickerDischageContentColor = $find(
"RadColorPickerDischargeConetnteColor"
);
//alert("LS_titleColor=" + LS_titleColor);
HiddenDischargeTitleColor.value = LS_titleColor;
if
(colorPickerDischargeTitleColor !=
null
&& LS_titleColor !=
null
)
{
colorPickerDischargeTitleColor.set_selectedColor(LS_titleColor);
}
HiddenDischargeContentColor.value = LS_contentColor;
if
(colorPickerDischageContentColor !=
null
&& LS_contentColor !=
null
)
{
colorPickerDischageContentColor.set_selectedColor(LS_contentColor);
}
}
My RadColorPciker control in aspx as below:
<telerik:RadColorPicker ID=
"RadColorPickerDischargeTitleColor"
runat=
"server"
PaletteModes=
"HSB"
ShowIcon=
"true"
OnClientColorChange=
"TelerikDemo.OnClientColorChangeDischargeTitleColor"
></telerik:RadColorPicker>
<telerik:RadColorPicker ID=
"RadColorPickerDischargeContentColor"
runat=
"server"
PaletteModes=
"HSB"
ShowIcon=
"true"
OnClientColorChange=
"TelerikDemo.OnClientColorChangeDischargeContentColor"
></telerik:RadColorPicker>
Do I lose something to define or how to solve this problem?