22 June 2013

ColorPickerExtender using ajax

Code:


<%@ Page AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Language="C#"
    MasterPageFile="~/Site.master" Title="Home Page" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <center>
        <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
        </asp:ToolkitScriptManager>
        <asp:Label ID="lbltitle" runat="server" Text="ColorPickerExtender using ajax" Font-Size="X-Large" Font-Bold="true"></asp:Label>
        <br />
        <br />
        Select Color:
        <asp:TextBox ID="txtColorCode" runat="server" Width="180px" Height="30px" CssClass="UBtxtField"></asp:TextBox>
        <asp:ImageButton ID="Image1" ImageUrl="color.jpg" Width="30px" Height="30px" runat="server" />
        <asp:ColorPickerExtender runat="server" ID="ColorPickerExtender1" TargetControlID="txtColorCode"
            PopupButtonID="Image1" OnClientColorSelectionChanged="colorChanged" />
        <script type="text/javascript">
            function colorChanged(sender) {
                sender.get_element().style.color =
       "#" + sender.get_selectedColor();
            }
   
        </script>
    </center>
</asp:Content>

Output:



No comments:

Post a Comment