|
//This particular function retreives and displays the currency results of the usered selected input
function DisplayCurrencyValue(link,currency)
{
var str,objXMLNode,objXMLDoc,objEmployee,strHTML;;
var stri=AJAXUtilities.GetCurrencyValue(link,currency);
str = stri.value;
var result=parseFloat(str);
var value=parseFloat(document.getElementById("txtConvert").value)
if(isNaN(value))
{
value=1;
document.getElementById("txtConvert").value=1
}
var city=document.getElementById("ddlTo");
var url=document.getElementById("ddlFrom");
var path=url.options[url.selectedIndex].text;
var pathCurr=url.options[url.selectedIndex].value;
var currencyAbr=pathCurr.substring(pathCurr.length-7,pathCurr.length-7+3);
var curr=city.options[city.selectedIndex].value;
result=result*value;
var str=value+" "+currencyAbr+" = "+ result +" "+curr;
document.getElementById("lblConverResult").value=str;
// document.getElementById("txtConvert").focus();
}
---------------------------------------------------------------
*
*
*
--------------------------------------------------------------
public string GetCurrencyValue(string url, string currency)
{
DataSet ds3 = new DataSet();
ds3.ReadXml(url, XmlReadMode.ReadSchema);
DataTable table = ds3.Tables[3];
string curren = currency.Trim();
string title = "";
string rate = "";
string exchange = "";
string outPut = "";
foreach (DataRow row in table.Rows)
{
title = row["title"].ToString();
int endPoint = title.IndexOf("=");
int startPoint = title.IndexOf("(");
int ePoint = title.IndexOf("(");
rate = title.Substring(endPoint + 2);
exchange = (rate.Substring(0, 3));
if (exchange.Equals(curren))
{
outPut = rate.Substring(5, (rate.Length - 1) - 5);
}
rate = title.Substring(startPoint + 1, 3);
}
decimal tr = Convert.ToDecimal(rate.Substring(0, rate.Length - 1));
tr = tr * 100;
//XmlDocument xmlDoc = new XmlDocument();
return outPut;
}
--------------------------------------------------------------------
-------------------------------------------
Result displaying lick this:
200 USD = NaN INR
plz tell me why hear NaN is displaying..
--------------------------------------------
|
|
|
|
|
NaN - Not A Number?
Try converting all those strings to decimals before doing any calculations and/or comparisons.
|
|
|
|
|
Hi everyone,
I have always held some kind of a fascination with the resource editor in Visual Studio. I could never understand how VS allows a user to drag/resize/modify buttons, edit boxes, and other controls on a dialog inside a window.
Can anyone throw some light on the matter?
Thanks!
_________________________
Kri5
|
|
|
|
|
|
Thanks !
_________________________
Kri5
|
|
|
|
|
Microsoft hired Harry Potter to write it.
Sorry, couldn't resist...
|
|
|
|
|
hehe..
_________________________
Kri5
|
|
|
|
|
hi to all!
I m implementing Bandwidth monitor and i don't know i can do this.
I want to know how i can determine the network packet size and
want to calculate the network bandwidth usage .
can anyone tell me how i can determine the incoming or out going packet size in c# and what is the formule to calculte the bandwidth usge ?
thanks to all.
Tahir
|
|
|
|
|
Hi,
Please, I'm using SQL Server and stored procedures which generates many numerical values (floats).
I'd like to know, using Visual C#, how to format these values into one of the two following formats: #,##E+## or #,##E-##
Thank you so much in advance !
|
|
|
|
|
float f = 1.23456789F;
Console.WriteLine(f.ToString("E2"));
|
|
|
|
|
Custom Numeric Format Strings[^]
Standard Numeric Format Strings[^]
In your case, you would make a call like the following:
float f = 178.92;
string res = f.ToString("0.00E+00");
Note that the decimal point is always coded as '.' even though on your machine it will appear as a ','. Hope this helps,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Thank you so much, it works very well !
By the way, do you know if it is possible to do it directly by my stored procedures ?
|
|
|
|
|
I don't know anything about stored procedures. Perhaps you could post in the SQL forum to see if there is a way to do that.
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
why would you want a stored proc to do this? Stored procs are for retrieving data, not formatting it for display.
|
|
|
|
|
because, now, I'm using GridViews which are databinded directly by stored procedures. So if it is possible to format my results inside my stored procedures before databinding, it will be much more simpler for me !!!
|
|
|
|
|
no, its not because you have exactly the same formatting ability when databinding
Eval("myNumericNumber","E2")
|
|
|
|
|
Hi,
I have just did the test: it seems to be not working very well ?!
As result, I have "E2" !
Are you sure that using Eval("myNumericNumber", "E2") when databinding gives the same result that formatting in C# by: myNumericNumber.ToString("E2") ?
|
|
|
|
|
Hi,how can i maintain the position of the scrollbar on ostback.
Page.MaintainScrollPositionOnPostBack = true;
i tried,its not working for me....
im using updatepanel...
Hi,Im Razana
|
|
|
|
|
hi
iam new to .net.can anyone tell me how to do paging in datalist and also i want to display like
"page 6 to 10 of 100" information in the footer.can anyone tell me how to do this?
Thanx in advance
pintoo
|
|
|
|
|
Hi,
I created a project in c#.net using MySql as database. I created a setup and installed it into another client machine but at the time of installation i need to check whether MySql database exist in the client machine.Is this possible in C#.net? Plz Help Me
Thanks in Advance
Smithakrishnan
|
|
|
|
|
connect the database , it will throw the exception,
from the exception you can easily find, the database is not found!.
|
|
|
|
|
I want to copy the subitems in a Listview, then I found it does not support this function?
how to do then?
thanks.
|
|
|
|
|
Overload the keypress and keydown messages for the listview, then listen for the event "Ctl-C". Once the event occurs, copy the selected contents to the clipboard. You could also add a context menu to the list view, and have copy as an option within the dropdown. On click, you would do the same thing as when the user presses Ctl-C. Hope this helps,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
On closing the form i need to save some data so in which event should i call the function to save data.
i am doing it inside Form1_FormClosed();
but if the data is not proper it should return from there..it is returning but closing the form.
Is there any handler which gets called before Form1_FormClosed() event.
ThankXXX In Advance.
Truth Is The Simplest !!!!
|
|
|
|
|
FormClosing...
|
|
|
|