This is a migrated thread and some comments may be shown as answers.

Using RadNumericTextbox with KeyPad

0 Answers 57 Views
Input
This is a migrated thread and some comments may be shown as answers.
Elliott
Top achievements
Rank 2
Elliott asked on 31 May 2013, 02:29 PM
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
    Else
        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
        Get
            Return btnText
        End Get
 
        Set(ByVal value As String)
            btnText = value
        End Set
    End Property
 
    Public ReadOnly Property pTag() As String
        Get
            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
<div>
    <telerik:RadWindow ID="rwLumpSum" Modal="true" Top="0" Left="0" VisibleOnPageLoad="false" runat="server" >
        <ContentTemplate>
        <asp:UpdatePanel ID="cpLumpSum" UpdateMode="Conditional" runat="server">
        <ContentTemplate>
            <table>
            <tr>
            <td>Lump Sum</td>
            <td>
                <telerik:RadNumericTextBox ID="rntbLumpSum" MinValue="0" MaxValue="999.99" runat="server">
                    <NumberFormat DecimalDigits="2" />
                </telerik:RadNumericTextBox>
            </td>
            </tr>
            <tr>
            <td colspan="2">
                <keypad:KeyEntry ID="KeyEntry1" runat="server" />
            </td>
            </tr>
            <tr>
            <td>
                <telerik:RadButton id="rbCancel" Text="Cancel" OnClientClicked="rbCancelClicked" AutoPostBack="false" UseSubmitBehavior="false" CausesValidation="false" runat="server" />
            </td>
            <td>
                <telerik:RadButton id="rbUpdate" Text="Update" OnClientClicked="rbUpdateClicked" runat="server" />
            </td>
            </tr>
            </table>
        </ContentTemplate>
        <Triggers>
            <asp:PostBackTrigger ControlID="rbUpdate" />
        </Triggers>
        </asp:UpdatePanel>
        </ContentTemplate>
    </telerik:RadWindow>
</div>

No answers yet. Maybe you can help?

Tags
Input
Asked by
Elliott
Top achievements
Rank 2
Share this question
or