This is a discussion on How to cast the value entered in a textbox to integer in ASP.NET and C# .Net. within the ASP and ASP.NET Programming forums, part of the Web Development category; Hi All.... can anyone guide me, How to cast the value entered in a textbox to integer in ASP.NET ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Hi All.... can anyone guide me, How to cast the value entered in a textbox to integer in ASP.NET and C# .Net. thanks in advance.... thnx... |
| Sponsored Links |
| |||
| Hi Deeban, you can convert using Int32.Parse(TextBox1.Text); or by using System.Convert.ToInt32(TextBox1.Text); thanks...
__________________ Sathish Kumar.R ![]() Knowledge is meant to SHARE |
| |||
| Hi Sathish.... thanks for your reply i have one more doubt.... How to allow only numeric values in a textbox using ASP.NET Validator control? thanks in advance... |
| |||
| Hi Deeban... you can do this by using regular expression and here is the sample piece of code... <asp:TextBox id="txtNumber" Runat="server" /> <asp:RegularExpressionValidator ID="vldNumber" ControlToValidate="txtNumber" Display="Dynamic" ErrorMessage="Not a number" ValidationExpression="(^([0-9]*|\d*\d{1}?\d*)$)" Runat="server"> </asp:RegularExpressionValidator> i hope this will help you...
__________________ Sathish Kumar.R ![]() Knowledge is meant to SHARE |
| |||
| hi Deeban.... you can simple set the style property by "right, left,...." TextBox1.Style["text-align"]="right"; thnx...
__________________ Sathish Kumar.R ![]() Knowledge is meant to SHARE |
| |||
| Hi Sathish... I am running the query SQL="Select name from profile where proID=1"; and I am getting the result in Dataset dsdata. How can I read the text from the dataset and assign it to textbox1.text ? thanks in advance.... |
| |||
| Hi Deeban... here is the code for your question.. TextBox1.Text=dsData.Tables[0].Rows[0]["FieldName"].ToString(); thanks..
__________________ Sathish Kumar.R ![]() Knowledge is meant to SHARE |
| |||
| Hi Sathish... Why do I get error message "Option Strict On disallows implicit conversions from 'System.Web.UI.Control' to 'System.Web.UI.WebControls.TextBox'."? can you give me any solution...? |
| |||
| Hi Deeban, For type Casting apply the following steps string aprtxt; aprtxt = (TextBox) e.Item.FindControl["txtapr"]; i hope this will help you...
__________________ Sathish Kumar.R ![]() Knowledge is meant to SHARE |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How do you limit the length (in characters) of text entered in a textarea form field | GDevakii | HTML, CSS and Javascript Coding Techniques | 2 | 03-24-2008 08:41 PM |
| How do I check that text entered in a text form field is an integer? | itbarota | HTML, CSS and Javascript Coding Techniques | 2 | 10-26-2007 12:25 AM |
| How to create textbox without border? | ramkumaraol | PHP Programming | 2 | 09-07-2007 06:13 AM |
| Java handle integer overflows and underflows | vigneshgets | Java Programming | 1 | 07-12-2007 12:12 AM |
| Convert integer type variable to char array | oyu2o | C and C++ Programming | 0 | 03-10-2007 09:47 AM |