TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Krishnan Suba
NA
82
15.2k
How to remove trailing zeros in a decimal in C#
Dec 9 2019 5:32 AM
I using the code for price column
C# code:
sku.SKUPrice = ValidationHelper.GetDecimal(txtActualPrice.Text, default(decimal));
The value is binding the textbox is "0.000000000"
I need the output is "0.00" only.
The database column datatype is "decimal(18.9)"
If I run the "
alter table COM_SKU alter Column SKUPrice decimal(18,2) not null" query I am getting below error message.
Msg 5074, Level 16, State 1, Line 5
The index 'IX_COM_SKU_SKUPrice' is dependent on column 'SKUPrice'.
Msg 4922, Level 16, State 9, Line 5
ALTER TABLE ALTER COLUMN SKUPrice failed because one or more objects access this column.
<cms:CMSTextBox ID="txtActualPrice" runat="server" EnableViewState="false" CssClass="input__text"></cms:CMSTextBox>
<asp:RequiredFieldValidator ID="rfvActualPrice" runat="server" CssClass="EditingFormErrorLabel" ControlToValidate="txtActualPrice"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="revActualPrice" runat="server" CssClass="EditingFormErrorLabel"
ControlToValidate="txtActualPrice" ValidationExpression="((\d+)((\.\d{1,100})?))$"></asp:RegularExpressionValidator>
Reply
Answers (
2
)
RichTextBox binding
How to add domain to image virtual path