Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7052345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:22:20+00:00 2026-05-28T03:22:20+00:00

I have unusual problem with AJAX toolkit ColorPickerExtender. Javascript code works fine it changes

  • 0

I have unusual problem with AJAX toolkit ColorPickerExtender. Javascript code works fine it changes backgound color of extended textbox to picked color and text to picked color code also, but when I try to grab text of that Extended textBox from codebehind it return like it returns initial Text Value like javascript didn’t change it. Since this same code works on my other application I suspect that the problem is that I put ColorPickerExtender in UpdatePanel and then in User Control.Here is the code:

User Control Code where ColorPickerExtender is:

    <script language="javascript" type="text/javascript">
        function colorChanged(sender) {
            sender.get_element().style.backgroundColor = "#" + sender.get_selectedColor();
            sender.get_element().style.color = "#" + sender.get_selectedColor();
            sender.get_element().value = "0x" + sender.get_selectedColor();     
        }          
    </script>
...
...
<asp:TextBox ID="ColorTextBox" runat="server" ReadOnly="True" BackColor="Black" Text="" >0x000000</asp:TextBox>
                <asp:ColorPickerExtender ID="ColorTextBox_ColorPickerExtender" runat="server" Enabled="True" TargetControlID="ColorTextBox" OnClientColorSelectionChanged="colorChanged" PopupButtonID="PickColorButton">
                </asp:ColorPickerExtender>
                <asp:Button ID="PickColorButton" runat="server" Text="Pick Color" />

Page Code (Upper user control is wrapped in Panel and than update panel):

            <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="PostNewThoughtButton1" PopupControlID="pnlThoghtPopup" BackgroundCssClass="modalBackground" DropShadow="false" />
...
    <asp:Panel ID="pnlThoghtPopup" runat="server"  Style="display:none;">
    <asp:UpdatePanel ID="pnlUpdate" runat="server">
    <ContentTemplate>
<My:NewThoughtPopup ID="NewThoughtPopup1" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>

So when I try to call this in codebehind:

string color = ColorTextBox.Text;

color always returns inital value of: 0x000000 altought everything seems fine from client side ColorTextBox text gets updated and it’s color changed,nothing happens on server side, do I have to call postback before trying to get string color? Note: same code works fine without update panel and when not using it on user control

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:22:20+00:00Added an answer on May 28, 2026 at 3:22 am

    I had a similar problem – it’s because the TextBox is set to ReadOnly="True"
    you can use a HiddenField additionally to your TextBox

    <asp:HiddenField ID="HiddenFieldColorText" runat=server />
    

    and in javascript just set the value of the HiddenField with

    document.getElementById('<%=HiddenFieldColorText.ClientID %>').value = yourColorString;    
    

    because you set the value of the HiddenField in Javascript and you want this value again on PostPack you need to set it again on Page_Load with

    HiddenFieldColorText.Value = Request.Params[HiddenFieldColorText.UniqueID];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have an unusual javascript problem, i have a javascript problem that alternately refuses
i have an really unusual problem i've never had before. i've no .htaccess file
I have a rather unusual problem, and it is hurting my brain. Problem: Given
I have an unusual problem. Let's consider such models (taken from django docs): class
I have a somewhat unusual problem. In my app, I am shadowing a UIImageView
I have a unusual problem throwing an exception An attempt was made to load
Salute.. I have an unusual problem. Here in this table in MSDN library we
Unusual problem here: I have an app that uses a text file which contains
I am having a strange problem in my code. I have many asserts scattered
I have an unusual problem. I've been implementing Merge Sort and have encountered the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.