DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2008
    Posts
    4

    Question Restrict TextBox to take only numbers.

    Hi,

    This is my dynamic created textbox
    Code:
    Dim Txtdynamic As TextBox = New TextBox
    Txtdynamic.ID = "id1"
    c_placeholder.Controls.Add(Txtdynamic) '
    used in
    Code:
    <asp:PlaceHolder runat="server" ID="c_placeholder"></asp:PlaceHolder>
    My question is how do I restrict this text box to take only numbers.

    I got some hint like
    Code:
    <asp:TextBox ID="TextBox1" runat="server" onkeypress="return increment(event)" ></asp:TextBox>
    but problem is onkeypress event not supported in ASP.Net (in my little knowledge) and I dont use <asp:TextBox> control

    Thanks in Advance

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,652
    Welcome to DevX

    See this example. Hopefully it has what you are looking for.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  3. #3
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  4. #4
    Join Date
    Sep 2008
    Posts
    4
    Thank You, Its realy help

  5. #5
    Join Date
    Jul 2012
    Posts
    5

    Hi follow this link it is for both for decimal and for integer..


Similar Threads

  1. Create User Wizard
    By saquib189 in forum ASP.NET
    Replies: 1
    Last Post: 09-19-2008, 01:57 PM
  2. add numbers from listbox to a textbox
    By golfmaltais in forum .NET
    Replies: 17
    Last Post: 10-02-2007, 11:43 AM
  3. Add numbers from a list to textbox
    By wesoonline in forum VB Classic
    Replies: 2
    Last Post: 02-21-2007, 09:20 AM
  4. Replies: 1
    Last Post: 07-07-2006, 05:37 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links