Using RadNumericTextbox with KeyPad

1 posts, 0 answers
  1. Elliott
    Elliott avatar
    391 posts
    Member since:
    May 2010

    Posted 31 May 2013 Link to this post

    I put a RadWindow to popup on a button click on a web page
    the control contains a RadNumericTextbox, a user control consisting of 10 buttons 0-9 and 2 buttons Cancel and Update

    the keypad is supposed to grab the number entered and concatenate it to the number in the textbox
    only problem is, I can't seem to be able to figure out how to enter decimal digits i.e. cents
    ' this method handles lump sum entry of one character using the pen
    ' it also is called using a mouse
    Private Sub KeyEntry1_SubmitClicked() Handles KeyEntry1.SubmitClicked
        ' if the button tapped was the del button clear the qty textbox
        If KeyEntry1.pTag.ToString() = "del" Then
            rntbLumpSum.Value = Nothing
            rntbLumpSum.Text = ""
            ' otherwise append the character in the Tag property to the
            ' qty textbox
        ElseIf KeyEntry1.pTag.ToString() = "." Then
            rntbLumpSum.Text += KeyEntry1.pTag.ToString()
        End If
    End Sub
    Imports Telerik.Web.UI
    Partial Class KeyEntry
        Inherits System.Web.UI.UserControl
        Public Delegate Sub SubmitClickedHandler()
        Private btnText As String
        Private key_press As String
        Public Event SubmitClicked As SubmitClickedHandler
        Public Property keyPad() As String
                Return btnText
            End Get
            Set(ByVal value As String)
                btnText = value
            End Set
        End Property
        Public ReadOnly Property pTag() As String
                Return key_press
            End Get
        End Property
        Protected Sub button_Click(sender As Object, e As EventArgs) Handles Bdel.Click, B0.Click, B1.Click, B2.Click, B3.Click, B4.Click, B5.Click, B6.Click, B7.Click, B8.Click, B9.Click, Bdot.Click
            btnText = DirectCast(sender, RadButton).Text
            key_press = DirectCast(sender, RadButton).Text
            RaiseEvent SubmitClicked()
        End Sub
    End Class
    the RadWindow
        <telerik:RadWindow ID="rwLumpSum" Modal="true" Top="0" Left="0" VisibleOnPageLoad="false" runat="server" >
            <asp:UpdatePanel ID="cpLumpSum" UpdateMode="Conditional" runat="server">
                <td>Lump Sum</td>
                    <telerik:RadNumericTextBox ID="rntbLumpSum" MinValue="0" MaxValue="999.99" runat="server">
                        <NumberFormat DecimalDigits="2" />
                <td colspan="2">
                    <keypad:KeyEntry ID="KeyEntry1" runat="server" />
                    <telerik:RadButton id="rbCancel" Text="Cancel" OnClientClicked="rbCancelClicked" AutoPostBack="false" UseSubmitBehavior="false" CausesValidation="false" runat="server" />
                    <telerik:RadButton id="rbUpdate" Text="Update" OnClientClicked="rbUpdateClicked" runat="server" />
                <asp:PostBackTrigger ControlID="rbUpdate" />
Back to Top