--scenario--
i have two text box and drop down
TMS.API.Reimbursement.VO_Reimbursement_SC objClaimListApproval_SC = new TMS.API.Reimbursement.VO_Reimbursement_SC();
objClaimListApproval_SC.Hub_ID = ddl_Hub.SelectedItem.Value;
objClaimListApproval_SC.UserID = txtUserID.Text;
objClaimListApproval_SC.Claim_amount = Convert.ToDecimal(txt_Claim_Amount.Text);
--properties are declared in
TMS.API.Reimbursement.VO_Reimbursement_SC();
public string Hub_ID
{
get;
set;
}
public string UserID
{
get;
set;
}
public decimal Claim_amount
{
get;
set;
}
----doubt---when i debug--and reach
objClaimListApproval_SC.Claim_amount = Convert.ToDecimal(txt_Claim_Amount.Text);
it goes into catch block.... i get to know that format exception was caught
Input string was not in a correct format.
---If i make the proprty string ,,,and change remove conver.todecimal i get no error
objClaimListApproval_SC.Claim_amount = txt_Claim_Amount.Text;
Why this error is happening ..can we use decimal property ?
I tried this:
objClaimListApproval_SC.Claim_amount = decimal.Parse(txt_Claim_Amount.Text);
//same error
---The text box may be empty or the number that user enters[like 500 or 500.00].
--currently the above explanation is like i was not entering anything...so obviously its empty
--and i was getting input string not in proper format.
--Now question is why cannot we convert the string to decimal and store it in that objClaimListApproval_SC.Claim_amount and pass the xml to stored procedure and do the manipulation
--If i pass string it works fine and in stored procedure i have to use the claim amount as
varchar[declare a variable claim amount as varchar]...and the xml that we fetched which contains claim amount we store it in the variable declared ...and do the manipulation
--I was just thinking like pass decimal value from front end....and pass the xml to stored procedure ....and in stored procedure[declare a variable claim amount as decimal].. and the xml that we fetched which contains claim amount we store it in the variable declared ...and do the manipulation
----But this doesnot work.....that is the doubt