RadNumericTextBox Value Posting

4 posts, 0 answers
  1. Manoj
    Manoj avatar
    4 posts
    Member since:
    Dec 2007

    Posted 26 Nov 2013 Link to this post

    Hi friends am using radnumeric Textbox control in my Application.
    Here am facing the Problem is when I logging in as Dutch Culture.
    Becoz it is considering "." as "," and vice versa.

    For Example :

    I am giving input as [ 2.25 in US] for this 
                      in dutch am giving as 2,25 when am selecting / submitting it is going as 225 in Database.
    where am doing mistake, kindly help me.

    Please find attachment of File one and two..
    file 01 contains actual value and when I click mouse inside textbox changes. refer second image
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 26 Nov 2013 Link to this post

    Hi Manoj,

    Please have a look into the sample code snippet which works as expected.

    ASPX:
    <telerik:RadNumericTextBox ID="RadNumericTextBox2" runat="server" Type="Currency"
        Culture="Dutch">
    </telerik:RadNumericTextBox>
    <telerik:RadButton ID="RadButton1" runat="server" Text="Get Text Value" OnClick="RadButton1_Click">
    </telerik:RadButton>

    C#:
    protected void RadButton1_Click(object sender, EventArgs e)
    {
        string text = RadNumericTextBox2.Text;
        String connectionstring = WebConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString;
        SqlConnection sqlconn = new SqlConnection(connectionstring);
        try
        {
            sqlconn.Open();
            SqlCommand command = new SqlCommand("Insert into DemoTable (number) Values (@number)", sqlconn);
            command.Parameters.Add("@number", SqlDbType.VarChar).Value = text;
            command.ExecuteNonQuery();
        }
        finally
        {
            sqlconn.Close();
        }
    }

    Thanks,
    Shinu.
  3. Manoj
    Manoj avatar
    4 posts
    Member since:
    Dec 2007

    Posted 27 Nov 2013 Link to this post

    Along with this am facing another one issue.....
    logging in Dutch [ nl-NL ] and getting data from SQL and assingning in dataset.

    objDataset.Tables[0]["AMOUNT"] value will be " 2.568 " in US Culture.

    txtRadNumericTextBox.Text = objDataset.Tables[0]["AMOUNT"].ToString()

    After this textbox value changed to 2568.. which is wrong....

    I cant overrite .ToString() To ToString(EnglishCulture) in every page..

    Becoz we having plenty of Modules and Forms.. Give me a common solution to avoid this.
  4. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 29 Nov 2013 Link to this post

    Hi Manoj,

    Please have a look into the sample code to achieve your scenario. 

    ASPX:
    <telerik:RadNumericTextBox ID="RadNumericTextBox1" runat="server" Type="Currency"
        Culture="nl-NL">
    </telerik:RadNumericTextBox>
    <telerik:RadButton ID="RadButton2" runat="server" Text="Set Text" OnClick="RadButton2_Click">
    </telerik:RadButton>

    C#:
    protected void RadButton2_Click(object sender, EventArgs e)
    {
        String connectionstring = WebConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString;
        SqlConnection sqlconn = new SqlConnection(connectionstring);
        DataTable data = new DataTable();
        SqlDataAdapter adapter = new SqlDataAdapter();
        DataSet ds = new DataSet();
        adapter.SelectCommand = new SqlCommand("select * from DemoTable", sqlconn);
        adapter.Fill(data);
        ds.Tables.Add(data);
        //set the fist value from the table in numerictextbox
        RadNumericTextBox1.Text = ds.Tables[0].Rows[0]["number"].ToString();
    }

    Thanks,
    Shinu.
Back to Top