JuiceUI Slider - ValueChanged event not firing
-
21-06-2021 - |
Pergunta
I'm trying to include a JuiceUI Slider control inside a ASP.NET GridView control where each row will have a unique slider control. As a test I created a Slider control:
<juice:slider ID="MasterThresholdSlider" Value="50" Min="0" Max="100" runat="server"
Step="25" ValueChanged="MasterThresholdSlider_ValueChanged"></juice:slider>
<asp:TextBox ID="MasterThresholdText" runat="server"></asp:TextBox>
Now from the documentation I have read, I can detect the value being changed when the ValueChanged event is raised. So in the code behind I have created the following:
protected void MasterThresholdSlider_ValueChanged(object sender, EventArgs e)
{
Juice.Slider slider = (Juice.Slider)sender;
MasterThresholdText.Text = slider.Value.ToString();
}
For some reason the event doesn't fire when I run the application (breakpoint is at the beginning of the event). Anyone know what I'm doing wrong?
Solução
You'll need to add AutoPostBack="true" to the juice:slider control to initiate an autopostback. Otherwise that event won't fire until something else on the page triggers a postback.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow