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

RadNumericTextBox Value Posting

3 Answers 191 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Manoj
Top achievements
Rank 1
Manoj asked on 26 Nov 2013, 09:46 AM
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

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 26 Nov 2013, 10:31 AM
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.
0
Manoj
Top achievements
Rank 1
answered on 27 Nov 2013, 09:04 AM
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.
0
Shinu
Top achievements
Rank 2
answered on 29 Nov 2013, 07:02 AM
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.
Tags
General Discussions
Asked by
Manoj
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Manoj
Top achievements
Rank 1
Share this question
or