Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

SliderExtender updating bound control with custom text

$
0
0

I have the following code in a user control:

<asp:TextBox ID="txtChapter" runat="server" AutoPostBack="true" />

<asp:UpdatePanel ID="upChapter" runat="server">
  <ContentTemplate>
    <asp:Label ID="lblChapter" runat="server" />
  </ContentTemplate>
  <Triggers>
    <asp:AsyncPostBackTrigger ControlID="txtChapter" EventName="TextChanged" />
  </Triggers>
</asp:UpdatePanel>

<ajaxToolkit:SliderExtender ID="seChapter" runat="server" BoundControlID="lblChapter" EnableHandleAnimation="true" Length="200" RailCssClass="ajax__slider_h_rail slider" TargetControlID="txtChapter" />

<asp:Button ID="btnChapter" runat="server" Text="Go" />

Here are snippets of code from its code-behind:

Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load

  With seChapter
    .Maximum = TotalNumChapters
    .Minimum = 1
  End With

  Dim CurrScriptMgr As ScriptManager = ScriptManager.GetCurrent(Me.Page)
  CurrScriptMgr.RegisterAsyncPostBackControl(txtChapter)

End Sub

Protected Sub txtChapter_TextChanged(sender As Object, e As System.EventArgs) Handles txtChapter.TextChanged
  UpdateChapterDisplay()
End Sub

Private Sub UpdateChapterDisplay()
  lblChapter.Text = "Chapter " & txtChapter.Text
End Sub

When I move the slider and unclick the mouse, the Label updates. That part is okay.

However, if I take the Label out of the UpdatePanel and let it display the integer value of the TextBox, it continuously updates the Label as I slide the Slider, even before I unclick the mouse. Is there a way to get my Label to update continuously with my custom text just like it does without the UpdatePanel?


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>