Can't Multiply Int By Int And Get A Decimal (0,00)?

Sep 30, 2010

I have two int in my applicantion and I want multiply and share by 100. This number can be like 7,5 but my decimal result member always save just 7.how can I deal with this question?

Ex.:
decimal result = 0;
decimal a = 15;
decimal b = 50;
result = (a*b)/100;

View 5 Replies


Similar Messages:

Data Controls :: Round Up Decimal Value Upto Two Decimal Places In GridView

Aug 22, 2012

i hav one data table in which some decimal values are up 6 decimal places.. im trying to bind that Data table to DataGridView while binding i want to round decimal values up to two decimal palces here is my code

dt.Columns.Add("Orderid", typeof(string));
dt.Columns.Add("tagnumber", typeof(string));
dt.Columns.Add("Minimum Value", typeof(string));
dt.Columns.Add("Maximum Value", typeof(string));
int count = ds.Tables[0].Rows.Count;
for (int i = 0; i < count; i++)

[code]...

hows hould i round up while binding..?

View 1 Replies

Data Controls :: GridView Export To Excel - Round Decimal Numbers To Two Decimal Places

May 7, 2015

I was read your post: "Export GridView to Excel in ASP.Net with Formatting using C#" and is very useful. That code works perfect. But I need create a new format for a specific column in my sheet before to export it. For example:My DataTable have a column with decimal numbers and I'm trying reduce the tenths for each number.I want this: 2,874444 ----> 2,87 for a specific range. In this case I need it for all numbers in the column 13 or well said for the Column called N in Excel. Only reduce two tenths.

I used:

xlWorkSheet.Range["N"+h,"N"+h].NumberFormat = "0.00";

And no works (h is for rows, N is the column. Into a foreach).

View 1 Replies

DataSource Controls :: Decimal Values Not Updating With Decimal Places?

Apr 6, 2010

I'm trying to execute this statement every minute with SQL Agent, I have it set up as a job:

[Code]....

It's trying to update a column which data type is set to decimal. Just so you know what I really need out of it, here is an example:

[Code]....

The answer of which should add on 0.5 to the original value. If I were to use the increase value of 60 which then becomes 60/60 it will work.I'm dividing by 60 because the increase value is per hour so I make it smaller to get per minute value. Why is it doing this?

View 2 Replies

C# - Doing A Math.Round(x,2) On A Decimal Value, But Need To Ensure 2 Numbers After Decimal As Its Money

Mar 3, 2010

Some values are returning 2.0 but I need it to be 2.00 as this is a money value that is displayed to the web page.

I am doing:

Math.Round(value, 2);

Is there a way to force it to 2 numbers after the decimal?

View 3 Replies

Validation Regex For Decimal - Allow Upto 5 Digits After Decimal?

May 5, 2010

I need a validation regex for decimal. It should allow upto 5 digits after decimal.

Allow:
1
1.0
12.0
12.01
123.01
1,123.01
1,123.013
21,123.01234
3,21,123.01234

How Can I do regex for this?

View 4 Replies

MVC :: TextBoxFor Decimal Member Without Decimal Places?

Feb 28, 2011

I got a decimal member in my viewmodel and get populated from the database (say 55.5, or 100.00)

In my view I use TextBoxFor<> for this member.

Is there any way to have a number (it's actually a percentage) like 100.00 display as 100 instead, and 55.50 as 55.5?

View 1 Replies

Web Forms :: How To Multiply 2 Textbox Values

Feb 2, 2011

I want to multiply two textbox values and result should be displayed in another textbox

txtoqt*txtqty=txtqtyreq

should not be keypress event because both values(txtOQty and txtQty) are retreving from database.

View 8 Replies

Crystal Reports :: How To Multiply Split Value

Dec 15, 2010

I have The following structure in my crystal report

Qty Rate
5 2,4,6
10 1,5,20

I need like this in my crystal report

Qty Rate Amount Total
5 2,4,6 10,20,30 60
10 1,5,20 10,50,200 260

View 2 Replies

C# - How To Multiply Text Box Values With Javascript

Aug 20, 2010

I would like to multiply the values from two text boxes (txtBox1 should contain an Integer value, txtBox2 should contain a Float value) and place the result in a third text box. My code is below, but it doesn't work. The javascript function is called, otherwise it fails.

[Code]....

View 2 Replies

Multiply Textbox With Gridview Columns?

Jan 15, 2011

I have write this code to create a gridview with 3 columns

DataTable dt = new DataTable();
dt = new DataTable();
dt.Columns.Add("ID", typeof(int)).AutoIncrement = true; [code]....

I would like to add in this code a textbox with the quantity.When i give the quantity i want in another textbox to have the total.

for example 2*1.5=3

How can i do that? My huge problem is that i dont know how to take the values of the 3rd column.The value 1.5 in this example.

View 2 Replies

Multiply Different Selected Checkboxes Text Into Textbox?

Nov 13, 2010

If i have 55 checkboxes with different text 1,2,3,4 and so on ....and a textbox where it display how many no. of checkboxes checked i want to multiply the multiple selected checkbox text with how many checkboxes are checked in other textbox i want to do this using vb.net,asp.net

View 1 Replies

Web Forms :: Multiply Values From Dropdownlist And Textbox?

Jan 29, 2010

I have a dropdownlist which display the price of products which is retrive from database, how do i mulitply if the user entered the quantity in the textbox. I keep getting error input string was not in a correct format.

Here is my aspx code:

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Order.aspx.cs" Inherits="Order" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">[code]......

View 1 Replies

Forms Data Controls :: Multiply Two Columns In A Table?

Feb 17, 2011

I wonder how to muliply two columns in a table and the result is displayed in the blank column and be specified by its row..

View 3 Replies

How To Pull Values From A QueryString / Add/Multiply Them And Then Write To A Label

May 5, 2010

I'm at the end of a project and have hit a wall. I'm pretty unfamiliar with VB so this is why I've left this piece of the project for last.

I have a popup window in which I pass some values via QueryString. I want to be able to pull them into my application and do some math on them and then write them out to my aspx page. The problem is I don't know where/how to begin. I've searched around the asp.net boards, but can't seem to find any good starting point.

I'm reading in some dollar amounts, a percentage and an Id that I'll use to pull a payment schedule (number of payments). I'm trying to get at a payment breakdown. I was thinking of writing it Something like this:

[Code]....

View 3 Replies

Data Controls :: How To Multiply Two Column Values In GridView

May 7, 2015

How To Multiply TwO  Values In GridView In asp.net using c#

View 1 Replies

Get Decimal Value Decimal.Round?

Feb 15, 2011

int Def[0] = {6};
iMaxValue = 55;
decimal val = Decimal.Round(Convert.ToDecimal((DefCount[I]) / iMaxValue),3);

here if i try to run this it says answer 0 ; but if i want 0.1090

View 1 Replies

Forms Data Controls :: How To Multiply Gridview Rows With Textbox

Jan 15, 2011

I have write this code to create a gridview with 3 columns

DataTable dt = new DataTable();
dt = new DataTable();
dt.Columns.Add("ID", typeof(int)).AutoIncrement = true;
dt.Columns.Add("Name", typeof(string));
dt.Columns.Add("Price(Grouch)/Hectares", typeof(float));
DataColumn[] keys = new DataColumn[2];
keys[0] = dt.Columns["ID"];
dt.PrimaryKey = keys;
dt.Rows.Add("1", "Seaside Location", 1.5);
Session[key] = dt;
return dt;

I would like to add in this code a textbox with the quantity.

When i give the quantity i want in another textbox to have the total.

for example 2*1.5=3

How can i do that?

My huge problem is that i dont know how to take the values of the 3rd column.The value 1.5 in this example.

View 2 Replies

Forms Data Controls :: View Calculations - Multiply 2 Columns And Display Rate

Jan 17, 2011

I have a FormView Bound to an SQL data source. In the DATA there are 2 columns that i would like to multiply together and display there rate

<asp:TextBox ID="txtPeople" runat="server" Text='<%#&nbsp;Bind("People")&nbsp;%>'></asp:TextBox><asp:TextBox ID="txtRate" runat="server" Text='<%#&nbsp;Bind("Rate")&nbsp;%>'></asp:TextBox><asp:TextBox ID="txtTotal" runat="server" Text='<%#&nbsp;Bind("Rate * People")&nbsp;%>'></asp:TextBox>

This is just an example above but i believe it shows what i am trying to do, there is no calculated column in the database so i can not bind to that directly, and i can not just add the column to the data as its not in my permissions. So how do "Bind" the value of two columns multiplied together to a third text box?

View 3 Replies

Data Controls :: Multiply Values Of Two Columns Of GridView TextBoxes Using JavaScript And JQuery

May 7, 2015

Multiplication of two columns in gridview and display the result in third column using Javascript

View 1 Replies

Change Decimal To % Using .net?

May 14, 2010

I have a variable Amount in my class...

this Amount value is comming from database as decimal something .0.000654345 while displaying in grid I need to show this as % value..

View 6 Replies

How To Round Up To Two Decimal Places

Mar 29, 2010

i am not good at javascript, but trying to implement or google up a function that would only allow characters in a textbox to have

1. only numeric characters

2. 2 decimal places.

I got this online, but it slices the 3rd decimal, i want it to allow only 2 decimals, any pointers ?

[URL]

View 10 Replies

Comparing Decimal Values In C#

Feb 22, 2010

I have a few values in c#, how do i compare if a variable is equal to 5.5 ?

here is my code

double res = 4.5;
double ehi = 5.5 ;
bool
ehi= decimal.Compare( res, ehi);

View 3 Replies

How To Add A Decimal Point To A String

Jun 28, 2010

If I have a string/integer that looks like 123, how can I convert that to look like 12.3?Basically what I need is something faster (if possible) than thisMath.Round(Double.Parse(input / 1000), 1).ToString

View 1 Replies

Use Of MaskedEditExtender With Decimal Point?

May 21, 2010

I am using Ajax extender controls with asp.net 3.5 in particular MaskedEditExtender.My settinngs are:

Mask = 99.99
InputDirection = RighttoLeft
MaskType = number.

I can't seem to achieve what I want which is to set the focus just to the left of the decimal point. I try both InputDirection RightToLeft and LeftToRight. They both have problematic behavior. The example given by Microsoft on their web site, is close to want I want but I cannot achieve these results.See

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved