Note that there are some explanatory texts on larger screens.

plurals
  1. POASP.NET AJAX ColorPickerExtender client side works fine, codebehind color empty
    text
    copied!<p>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:</p> <p>User Control Code where ColorPickerExtender is:</p> <pre><code> &lt;script language="javascript" type="text/javascript"&gt; 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(); } &lt;/script&gt; ... ... &lt;asp:TextBox ID="ColorTextBox" runat="server" ReadOnly="True" BackColor="Black" Text="" &gt;0x000000&lt;/asp:TextBox&gt; &lt;asp:ColorPickerExtender ID="ColorTextBox_ColorPickerExtender" runat="server" Enabled="True" TargetControlID="ColorTextBox" OnClientColorSelectionChanged="colorChanged" PopupButtonID="PickColorButton"&gt; &lt;/asp:ColorPickerExtender&gt; &lt;asp:Button ID="PickColorButton" runat="server" Text="Pick Color" /&gt; </code></pre> <p>Page Code (Upper user control is wrapped in Panel and than update panel):</p> <pre><code> &lt;asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="PostNewThoughtButton1" PopupControlID="pnlThoghtPopup" BackgroundCssClass="modalBackground" DropShadow="false" /&gt; ... &lt;asp:Panel ID="pnlThoghtPopup" runat="server" Style="display:none;"&gt; &lt;asp:UpdatePanel ID="pnlUpdate" runat="server"&gt; &lt;ContentTemplate&gt; &lt;My:NewThoughtPopup ID="NewThoughtPopup1" runat="server" /&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; &lt;/asp:Panel&gt; </code></pre> <p>So when I try to call this in codebehind:</p> <p>string color = ColorTextBox.Text; </p> <p>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 </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload