How to use Color Picker Extender control in ajax?

aswinialuri-19361
Posted by aswinialuri-19361 under ASP.NET AJAX category on | Points: 40 | Views : 3103
By using color picker extender you can change the text color as your wish
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ColorPicker.aspx.cs" Inherits="ColorPicker" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

</script>
<script type="text/javascript">
function selectedColorChanged(sender) {
sender.get_element().style.color = "#" + sender.get_selectedColor();
sender.get_element().style.backgroundColor = "#" + sender.get_selectedColor();
document.getElementById('Label1').style.color = "#" + sender.get_selectedColor();
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>

</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:blue; font-style:italic;">Ajax ColorPickerExtender Example: How To Use PopupButtonID</h2>
<hr width="600" align="left" color="LightBlue" />
<asp:ScriptManager
ID="ScriptManager1"
runat="server"
>
</asp:ScriptManager>
<br /><br />
<asp:Label
ID="Label1"
runat="server"
Text="click here to cahnge text color."
Font-Size="XX-Large"
Font-Names="Comic Sans MS"
ForeColor="purple"
>
</asp:Label>


<asp:TextBox ID="TextBox1" runat="server" Height="18px" Width="20px" BackColor="purple" ForeColor="purple"></asp:TextBox>
<asp:ColorPickerExtender ID="TextBox1_ColorPickerExtender" runat="server"
Enabled="True" TargetControlID="TextBox1" OnClientColorSelectionChanged="selectedColorChanged">
</asp:ColorPickerExtender>

</form>
</body>
</html>

Comments or Responses

Login to post response